Skip to main content

Troubleshoot Cortex connection errors

Status: Ready

Article ID: 020

Truth label: Current

Audience: Agency operator

Reader outcome: Diagnose Cortex failures by separating browser origin, service host, port, bearer, CORS, health, and backend validation problems.

Related articles: 010, 011, 092

Target week: 08

Last verified: 2026-09-13

Technical reviewer: Codex source audit

Editorial reviewer: Codex editorial audit

Start with the request path​

Cortex uses the hostname from its own browser address. It calls Forge on port 8080 and Brain on port 8081. A page opened through one host can therefore fail even when services are healthy on another host.

Write down:

  • the Cortex browser address
  • the hostname Cortex will derive
  • whether the failing panel calls Forge or Brain
  • the expected service port
  • the HTTP status or browser error

Do not change several settings at once.

Check service health first​

Open the matching health route from the same trusted machine:

http://[service-host]:8080/health
http://[service-host]:8081/health

If health is unreachable, inspect service startup, bind host, host name, local firewall, and network route. A bearer change cannot fix a refused connection.

Health routes are intentionally public. A successful health response does not prove protected routes accept the browser.

Interpret the failure class​

Connection refused or network error​

The service is stopped, listening on a different host or port, blocked by a firewall, or unreachable from the browser machine. Confirm the process and bind configuration before changing Cortex.

CORS error​

The browser origin is not in the service's exact allowed-origin list. Record the scheme, host, and port shown in the browser. Add only the reviewed trusted origin. Do not use a wildcard to make the message disappear.

401 Unauthorized​

The API bearer is missing or rejected. Cortex dispatches an authentication event when a request receives 401. Enter the current bearer through the operator UI. Do not paste it into an article, screenshot, chat, or shared shell command.

The current storage key is agentasian-api-token. Cortex migrates the former key once for browsers connected before the rename.

One failure looks like a rejected token and is not. If every button does nothing and the token prompt keeps returning, the main module failed to parse and no listener bound, so the authentication overlay simply stayed up. Open the browser console: a syntax error there, not a 401, is the cause. Hard reload to drop a cached module.

403 Forbidden​

The bearer can be valid while the requested operation lacks the required operator authority or scope. Read the response detail. Do not treat 403 as a network failure.

404 Not Found​

Confirm the service port and route. Brain and Forge have different endpoints. A request sent to the correct hostname on the wrong port can return a real 404 from the wrong service.

422 or another validation error​

The service received the request but rejected its fields. Read the returned detail and compare the form value with the API contract. Common examples include invalid paths, states, scope combinations, control values, or task fields.

Use a narrow recovery sequence​

  1. Confirm Cortex loads.
  2. Confirm Forge health.
  3. Confirm Brain health.
  4. Confirm the derived hostname and ports.
  5. Confirm the exact browser origin is allowed.
  6. Confirm the bearer through the trusted UI.
  7. Retry one failing panel.
  8. Inspect browser network status and returned detail.
  9. Check the matching service log without copying sensitive content.

Current limits​

Cortex is not a public edge application. The bearer is stored in browser local storage, LAN use assumes trusted machines, and health routes do not require authentication. Never port-forward the service ports to the public internet.

Next lesson​

Continue with the Brain track in the article catalog.

Derivative map​

  • Weekly package: WEEK-08
  • Long video: VIDEO-W08-LONG
  • Shorts: SHORT-W08-PROBLEM, SHORT-W08-MECHANISM, SHORT-W08-WARNING
  • Email: EMAIL-W08
  • LinkedIn: LI-W08-A, LI-W08-B
  • X: X-W08-A, X-W08-B
  • Visual: VISUAL-W08

Review record​

  • Host, port, bearer, CORS, response, and health behavior checked against current source.
  • Trusted-browser, health-route, token-storage, and public-exposure limits reviewed.
  • Examples use only placeholders and contain no credential or private host.
  • Internal links and repository voice reviewed.

Review completed: 2026-08-27

Re-audited against the running product: 2026-09-13