different-ai/openwork · error · Error
Could not load egress diagnostics (${response.status}).
Error message
Could not load egress diagnostics (${response.status}). What it means
loadConfiguration in EgressDiagnosticsCard fetches GET /v1/diagnostics/egress (12s timeout) to render egress diagnostics availability. On a non-OK response it throws `Could not load egress diagnostics (${response.status})` unless the payload contains a server-provided message, which getErrorMessage prefers. The thrown error is caught and shown via setError, so the card displays the failure instead of diagnostics.
Source
Thrown at ee/apps/den-web/app/(den)/dashboard/_components/egress-diagnostics-card.tsx:105
const [error, setError] = useState<string | null>(null);
const [result, setResult] = useState<EgressDiagnosticRun | null>(null);
const [copied, setCopied] = useState(false);
const [bearerTokenDraft, setBearerTokenDraft] = useState("");
const [savingBearerToken, setSavingBearerToken] = useState(false);
const [editingBearerToken, setEditingBearerToken] = useState(false);
useEffect(() => {
if (!canView) {
setLoading(false);
return;
}
let cancelled = false;
async function loadConfiguration() {
setLoading(true);
try {
const { response, payload } = await requestJson("/v1/diagnostics/egress", { method: "GET" }, 12_000);
if (!response.ok) {
throw new Error(getErrorMessage(payload, `Could not load egress diagnostics (${response.status}).`));
}
const parsed = egressDiagnosticConfigurationSchema.safeParse(payload);
if (!parsed.success) throw new Error("Den returned an invalid diagnostics configuration response.");
if (!cancelled) {
setAvailable(parsed.data.available);
setTargetOrigin(parsed.data.targetOrigin);
setMissingConfiguration(parsed.data.missingConfiguration);
setError(null);
}
} catch (loadError) {
if (!cancelled) setError(loadError instanceof Error ? loadError.message : "Could not load egress diagnostics.");
} finally {
if (!cancelled) setLoading(false);
}
}
void loadConfiguration();
return () => { cancelled = true; };
}, [canView]);View on GitHub (pinned to 2b7df46e8a)
Solutions
- Read the HTTP status in the message and check Den server logs for GET /v1/diagnostics/egress; fix the root cause server-side.
- Re-authenticate if the status is 401/403 and confirm the user has admin access to diagnostics.
- If the status is 404, upgrade the Den server to a version that ships /v1/diagnostics/egress.
- For 5xx/502/503, wait for the backend to recover or restart the Den service, then reload the dashboard.
Example fix
// before
const { response, payload } = await requestJson("/v1/diagnostics/egress", { method: "GET" }, 12_000);
// server without endpoint -> 404 -> "Could not load egress diagnostics (404)."
// after: run a Den version that implements the diagnostics route
// (upgrade den-server; then the same call parses egressDiagnosticConfigurationSchema successfully) Defensive patterns
Strategy: try-catch
Validate before calling
if (!denSessionActive()) await refreshSession(); // prevent predictable 401 before loadConfiguration()
Type guard
function isHttpError(e: unknown): e is Error & { status?: number } {
return e instanceof Error && /\(\d{3}\)/.test(e.message);
} Try / catch
try {
await loadConfiguration();
} catch (e) {
if (isHttpError(e) && e.message.includes("404")) {
showNotice("Egress diagnostics unavailable on this Den server version.");
} else {
showError(e instanceof Error ? e.message : "Could not load egress diagnostics.");
}
} Prevention
- Feature-detect the diagnostics endpoint (or a capabilities route) before rendering the card.
- Keep Den server and dashboard versions aligned.
- Retry once with short backoff for transient 5xx/502 from proxies.
- Ensure the user has admin role before requesting diagnostics.
When it happens
Trigger: GET /v1/diagnostics/egress returns non-OK: 401/403 (unauthorized/non-admin), 404 (older Den server without the diagnostics endpoint), 5xx (backend error), or plan/feature gating on the diagnostics route. Also displayed when requestJson itself throws and the catch replaces it with the generic fallback string.
Common situations: Self-hosted Den version predates the egress diagnostics API; admin session expired; Den service restarting; reverse proxy returning 502/503 during backend deploy.
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
- Egress diagnostic could not start (${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/c1f00fc5484d7178.
Report an issue: GitHub.