different-ai/openwork · error · Error
Den returned an invalid egress diagnostic result.
Error message
Den returned an invalid egress diagnostic result.
What it means
When POST /v1/diagnostics/egress returns 2xx, runDiagnostic validates the body against egressDiagnosticRunSchema with safeParse. A 200 response whose body doesn't match the expected run-result shape throws "Den returned an invalid egress diagnostic result." The catch shows the message via setError; this is a deliberate contract check against malformed server data.
Source
Thrown at ee/apps/den-web/app/(den)/dashboard/_components/egress-diagnostics-card.tsx:146
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();
if (bearerToken.length < 24) {
setError("Enter a diagnostic token with at least 24 characters.");
return;View on GitHub (pinned to 2b7df46e8a)
Solutions
- Capture the raw 200 payload and diff it against egressDiagnosticRunSchema to find the failing field.
- Bring dashboard and Den server to the same version so the run-result schema matches.
- Inspect any proxy/middleware between the browser and Den for response rewriting, and bypass it for /v1/* routes.
- Re-run the diagnostic after fixing the server; confirm the worker emits the current result format.
Example fix
// before (worker returns legacy shape without per-check results)
// payload: { ok: true } -> safeParse fails
// after: upgrade Den diagnostics worker to emit the full run schema
// payload: { startedAt: ..., completedAt: ..., checks: [...] } Defensive patterns
Strategy: type-guard
Validate before calling
const plausibleRun = typeof payload === "object" && payload !== null;
if (!plausibleRun) throw new Error("Diagnostics run returned an empty body; skipping schema parse."); Type guard
function looksLikeDiagnosticRun(p: unknown): p is Record<string, unknown> {
return typeof p === "object" && p !== null && !Array.isArray(p);
} Try / catch
try {
await runDiagnostic();
} catch (e) {
if (e instanceof Error && e.message.includes("invalid egress diagnostic result")) {
console.error("Run-result contract mismatch; capture payload and check Den version.", e);
showError("Diagnostic result from Den is unreadable; verify server version.");
} else throw e;
} Prevention
- Log the raw 200 payload whenever safeParse fails to identify drifted fields.
- Keep the diagnostics worker and dashboard schema definitions in one shared package.
- Bypass/audit any middleware that rewrites response bodies on /v1/* routes.
- Add a contract test asserting the worker's output parses with egressDiagnosticRunSchema.
When it happens
Trigger: Server returns 200 but the run payload deviates from egressDiagnosticRunSchema: missing result fields, extra/renamed fields from a different Den version, an empty object, or a proxy injecting non-JSON content with a 200 status.
Common situations: Dashboard/Den version skew after a partial deploy; a diagnostics worker returning a legacy result format; reverse proxy or security middleware rewriting the response body.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Den returned an invalid diagnostics configuration response.
- Invalid cloud provider sync response.
- Invalid cloud provider sync status response.
- invalid_cloud_plugin
- Environment variable store has an invalid format
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/52dcac48a72a51e0.
Report an issue: GitHub.