Skip to content

Troubleshooting

A symptom-indexed reference. For each symptom, jump to the first applicable cause and follow the linked diagnostic page.

Browser-side symptoms

"ERR_CONNECTION_REFUSED" hitting the gateway URL

CauseFix
Gateway process is not runninghivecast status; hivecast start
Wrong portCheck host.json.http.port; verify with curl 127.0.0.1:<port>/healthz
Bound to 0.0.0.0 vs 127.0.0.1 mismatchCheck host.json.http.host

"404 Not Found" for /apps/<appName>/

CauseFix
No runtime registered the appmatrix invoke system.gateway.http gateway.http.status '{}' and verify the app is listed
Runtime is registered but not runninghivecast runtimes; status must be running
Wrong appName (typo, casing)App names are case-sensitive lowercase kebab-case
Path matches a public-namespace pattern that doesn't resolveReserved route key conflict — see Routes / Space routes

→ See Operations / Route diagnostics.

"502 Bad Gateway" with "exceeded relay limit"

The asset is >10 MB. Reduce the asset size or split it. The 10 MB limit is in MAX_RELAY_BODY_BYTES (projects/matrix-3/packages/system-gateway-http/src/index.ts:12).

"WebSocket connection failed" at /nats-ws

CauseFix
NATS process downhivecast status; verify NATS sibling running
Wrong NATS WS portCheck host.json.transport.nats.wsPort; default is 4271 for embedded, 4223 for cloud production
Caddy proxy misconfiguredCheck Caddyfile.bare; ensure /nats-ws proxies to NATS port
Browser CSP blocks the WebSocket originVerify same-origin; the bootstrap URL must match the page origin

"401" / "403" on app pages

The gateway itself doesn't authenticate today. If you're seeing 401/403, it's coming from system-auth middleware in front of specific endpoints, or from the bus authentication failing. Check the runtime's logs for auth-related errors.

App loads but doesn't connect to NATS

CauseFix
/api/bootstrap returns wrong natsWsUrlCheck transport.nats.wsUrl in host.json
Browser-side NATS auth failsInspect browser console; look for NATS CONNECT errors
busToken in bootstrap is invalidCheck auth.sessionSecret and auth.mode

→ See Overview / NATS WebSocket.

Operator-side symptoms

hivecast status reports "stopped" but port is bound

A previous gateway process didn't clean up its PID file or state. Force stop:

bash
sudo systemctl stop hivecast-host.service
sudo lsof -i :3100  # find any straggler processes
sudo kill <pid>

Then hivecast start.

/healthz works but /apps/... 404s for everything

The gateway is up, but system.runtimes may not be reachable, so _loadRoutes returns empty. Check:

bash
matrix invoke system.runtimes runtimes.registered '{}'

If this errors, the system runtime is down or the bus has not finished bootstrapping. hivecast doctor may report the issue.

Gateway logs show "Gateway actor has no Matrix context"

The actor was called before bootstrap completed. This is usually transient during startup; if persistent, the actor's parent runtime failed to initialize its bus context. Check the runtime's logs for earlier errors.

Public-route URLs return the platform shell instead of the app

Path matched the public-namespace parser before reaching the generic /apps/ rule. Check that the first URL segment isn't accidentally being parsed as space.<...> / domain.<...> / system.<...>. See Routes / Space routes.

Hot-reload (Vite dev) doesn't update

Origin-backed routes win over asset-mount when both exist. If hot-reload isn't kicking in, verify the runtime's webapp record has origin set, not just assetMount. Check the runtime's runtime.json:

bash
cat <host-home>/runtimes/<runtime-id>/runtime.json | jq .metadata.webapp

Build-time symptoms

pnpm --filter @open-matrix/system-gateway-http build fails

Most likely a cross-package import problem. Check that imports in src/*.ts use the package's own modules or declared dependencies, not ../../../ paths.

Type errors in system-gateway-http

The branch may need pnpm install or a clean rebuild. Try:

bash
pnpm --filter @open-matrix/system-gateway-http build --force

See also

Source: Issues observed across projects/matrix-3/packages/system-gateway-http/ and the cloud deploy pipeline. Cross-reference each symptom to the implementation file referenced.