different-ai/openwork · error · Error
Egress diagnostic could not start (${response.status}).
Error message
Egress diagnostic could not start (${response.status}). What it means
runDiagnostic POSTs /v1/diagnostics/egress with a long 90s timeout to execute an egress connectivity test. A non-OK response throws `Egress diagnostic could not start (${response.status})`, unless the payload supplies a server message via getErrorMessage. The error is caught and shown via setError; running state is reset in the finally block.
Source
Thrown at ee/apps/den-web/app/(den)/dashboard/_components/egress-diagnostics-card.tsx:143
useEffect(() => {
if (!copied) return;
const timeout = window.setTimeout(() => setCopied(false), 1_600);
return () => window.clearTimeout(timeout);
}, [copied]);
async function runDiagnostic() {
if (!canManage) {
setError("Only workspace owners and super-admins can run this diagnostic.");
return;
}
setRunning(true);
setError(null);
setResult(null);
try {
const { response, payload } = await requestJson("/v1/diagnostics/egress", { method: "POST" }, 90_000);
if (!response.ok) {
throw new Error(getErrorMessage(payload, `Egress diagnostic could not start (${response.status}).`));
}
const parsed = egressDiagnosticRunSchema.safeParse(payload);
if (!parsed.success) throw new Error("Den returned an invalid egress diagnostic result.");
setResult(parsed.data);
} catch (runError) {
setError(runError instanceof Error ? runError.message : "Egress diagnostic could not complete.");
} finally {
setRunning(false);
}
}
async function saveBearerToken() {
if (!canManage) {
setError("Only workspace owners and super-admins can change the diagnostic token.");
return;
}
const bearerToken = bearerTokenDraft.trim();View on GitHub (pinned to 2b7df46e8a)
Solutions
- Check the HTTP status and the Den server logs for the POST to /v1/diagnostics/egress to identify the server-side refusal reason.
- Ensure required configuration (e.g. the diagnostic bearer token) is saved first — use the token editor to PUT /v1/diagnostics/egress/token, then retry.
- If a diagnostic is already running (409), wait for it to finish and retry.
- Re-authenticate on 401/403; verify admin permissions.
- For 5xx, restart/inspect the Den diagnostics worker and retry after it recovers.
Example fix
// before: run diagnostic without a stored token -> server 400 await runDiagnostic(); // "Egress diagnostic could not start (400)." // after: save the token first, then run await saveBearerToken(); // PUT /v1/diagnostics/egress/token await runDiagnostic();
Defensive patterns
Strategy: try-catch
Validate before calling
if (!diagnosticsConfigured) {
openTokenEditor(); // save bearer token via PUT /v1/diagnostics/egress/token first
return;
} Type guard
function isHttpError(e: unknown): e is Error & { status?: number } {
return e instanceof Error && /\(\d{3}\)/.test(e.message);
} Try / catch
try {
await runDiagnostic();
} catch (e) {
if (isHttpError(e) && e.message.includes("409")) {
showError("A diagnostic is already running; try again shortly.");
} else {
showError(e instanceof Error ? e.message : "Egress diagnostic could not complete.");
}
} Prevention
- Complete token configuration before exposing the Run button.
- Disable the Run button while a diagnostic is in flight to avoid 409 races.
- Keep the 90s timeout generous but show progress so users don't retrigger.
- Re-authenticate expired sessions before long-running diagnostic calls.
When it happens
Trigger: POST /v1/diagnostics/egress returns 400 (diagnostics unavailable or bad request), 401/403 (auth/permission), 402 (feature gating), 409/503 (diagnostic already running or backend busy), or 5xx from the Den backend. Also surfaces when requestJson's 90s timeout aborts and the catch falls back to the generic completion message.
Common situations: Clicking Run diagnostic before the bearer token is configured (server refuses to start); two admins racing to run the diagnostic; Den worker failing to reach the target origin and erroring out; expired session.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
- Could not load egress diagnostics (${response.status}).
- Failed to load desktop policies (${response.status}).
- Could not save the diagnostic token (${response.status}).
- Failed to load inference settings (${response.status}).
- Failed to load dashboards (${response.status}).
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/67b2dbdfe72d51bd.
Report an issue: GitHub.