[GH-ISSUE #4] API Error: ServiceRegistry not initialized after installation #1

Closed
opened 2026-02-27 20:20:05 +03:00 by kerem · 2 comments
Owner

Originally created by @saflisgit on GitHub (Feb 24, 2026).
Original GitHub issue: https://github.com/ownpilot/OwnPilot/issues/4

Started with docker compose, configured an api key but cannot use chat or dashboard due to error like :
"API Error ServiceRegistry not initialized. Call initServiceRegistry() during startup."

Image
Originally created by @saflisgit on GitHub (Feb 24, 2026). Original GitHub issue: https://github.com/ownpilot/OwnPilot/issues/4 Started with docker compose, configured an api key but cannot use chat or dashboard due to error like : "API Error ServiceRegistry not initialized. Call initServiceRegistry() during startup." <img width="969" height="559" alt="Image" src="https://github.com/user-attachments/assets/193925e0-a681-4348-ba8b-4163bc535166" />
kerem closed this issue 2026-02-27 20:20:05 +03:00
Author
Owner

@UX1907 commented on GitHub (Feb 24, 2026):

Hi @saflisgit — I ran into the same issue and tracked it down. There are three bugs causing this:

1. ServiceRegistry not initialized (the main error)

The Docker entrypoint uses the CLI start command (node packages/cli/dist/index.js start) which has a lightweight startup path that skips the full ServiceRegistry initialization (all 23 services). The proper server entry point (packages/gateway/dist/server.js) registers everything correctly.

Fix — in Dockerfile, change:

- CMD ["node", "packages/cli/dist/index.js", "start"]
+ CMD ["node", "packages/gateway/dist/server.js"]

2. Docker health check shows "unhealthy"

Alpine Linux resolves localhost to IPv6 ::1, but the server binds to IPv4 0.0.0.0. The health check silently fails.

Fix — in Dockerfile:

- CMD wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1
+ CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:8080/health || exit 1

And in docker-compose.yml (gateway service healthcheck):

- test: ['CMD', 'wget', '--no-verbose', '--tries=1', '--spider', 'http://localhost:8080/health']
+ test: ['CMD', 'wget', '--no-verbose', '--tries=1', '--spider', 'http://127.0.0.1:8080/health']

3. Demo mode with non-standard providers (e.g. MiniMax)

If you configure a provider that isn't in the hardcoded list inside isDemoMode() (like MiniMax), the system still thinks it's in demo mode and returns canned responses instead of real AI output.

Fix — in packages/gateway/src/routes/agent-service.ts, replace the provider list check:

  export async function isDemoMode(): Promise<boolean> {
    const configured = await getConfiguredProviderIds();
-   const providers = [
-     'openai', 'anthropic', 'zhipu', 'deepseek', 'groq',
-     'google', 'xai', 'mistral', 'together', 'fireworks', 'perplexity',
-   ];
-   if (providers.some((p) => configured.has(p))) return false;
+   if (configured.size > 0) return false;

    const localProviders = await localProvidersRepo.listProviders();
    if (localProviders.some((p) => p.isEnabled)) return false;
    return true;
  }

After all fixes

docker compose --profile postgres down
docker compose --profile postgres up -d --build

All 23 services register correctly, health checks pass, and chat/dashboard work as expected.

<!-- gh-comment-id:3950489913 --> @UX1907 commented on GitHub (Feb 24, 2026): Hi @saflisgit — I ran into the same issue and tracked it down. There are **three bugs** causing this: ### 1. `ServiceRegistry not initialized` (the main error) The Docker entrypoint uses the CLI `start` command (`node packages/cli/dist/index.js start`) which has a lightweight startup path that **skips the full ServiceRegistry initialization** (all 23 services). The proper server entry point (`packages/gateway/dist/server.js`) registers everything correctly. **Fix** — in `Dockerfile`, change: ```diff - CMD ["node", "packages/cli/dist/index.js", "start"] + CMD ["node", "packages/gateway/dist/server.js"] ``` ### 2. Docker health check shows "unhealthy" Alpine Linux resolves `localhost` to IPv6 `::1`, but the server binds to IPv4 `0.0.0.0`. The health check silently fails. **Fix** — in `Dockerfile`: ```diff - CMD wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1 + CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:8080/health || exit 1 ``` And in `docker-compose.yml` (gateway service healthcheck): ```diff - test: ['CMD', 'wget', '--no-verbose', '--tries=1', '--spider', 'http://localhost:8080/health'] + test: ['CMD', 'wget', '--no-verbose', '--tries=1', '--spider', 'http://127.0.0.1:8080/health'] ``` ### 3. Demo mode with non-standard providers (e.g. MiniMax) If you configure a provider that isn't in the hardcoded list inside `isDemoMode()` (like MiniMax), the system still thinks it's in demo mode and returns canned responses instead of real AI output. **Fix** — in `packages/gateway/src/routes/agent-service.ts`, replace the provider list check: ```diff export async function isDemoMode(): Promise<boolean> { const configured = await getConfiguredProviderIds(); - const providers = [ - 'openai', 'anthropic', 'zhipu', 'deepseek', 'groq', - 'google', 'xai', 'mistral', 'together', 'fireworks', 'perplexity', - ]; - if (providers.some((p) => configured.has(p))) return false; + if (configured.size > 0) return false; const localProviders = await localProvidersRepo.listProviders(); if (localProviders.some((p) => p.isEnabled)) return false; return true; } ``` ### After all fixes ```bash docker compose --profile postgres down docker compose --profile postgres up -d --build ``` All 23 services register correctly, health checks pass, and chat/dashboard work as expected.
Author
Owner

@ersinkoc commented on GitHub (Feb 24, 2026):

Hey @saflisgit — thanks for reporting this! All three root causes have been fixed on main:

  1. ServiceRegistry not initialized — Docker CMD now uses packages/gateway/dist/server.js directly (full 23-service initialization) instead of the CLI start command.
  2. Docker healthcheck failing — Changed localhost127.0.0.1 (Alpine resolves localhost to IPv6 ::1 but the server binds IPv4).
  3. Demo mode with non-standard providersisDemoMode() now checks configured.size > 0 instead of a hardcoded 11-provider list.

These will be included in the next release. In the meantime you can build from main:

docker compose --profile postgres down
docker compose --profile postgres up -d --build

Closing this — feel free to reopen if you still hit issues!

<!-- gh-comment-id:3954825328 --> @ersinkoc commented on GitHub (Feb 24, 2026): Hey @saflisgit — thanks for reporting this! All three root causes have been fixed on `main`: 1. **`ServiceRegistry not initialized`** — Docker CMD now uses `packages/gateway/dist/server.js` directly (full 23-service initialization) instead of the CLI `start` command. 2. **Docker healthcheck failing** — Changed `localhost` → `127.0.0.1` (Alpine resolves localhost to IPv6 `::1` but the server binds IPv4). 3. **Demo mode with non-standard providers** — `isDemoMode()` now checks `configured.size > 0` instead of a hardcoded 11-provider list. These will be included in the next release. In the meantime you can build from `main`: ```bash docker compose --profile postgres down docker compose --profile postgres up -d --build ``` Closing this — feel free to reopen if you still hit issues!
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/OwnPilot#1
No description provided.