different-ai/openwork · error · Error
Agent diagnostics require a connected workspace.
Error message
Agent diagnostics require a connected workspace.
What it means
The agent-context diagnostics collector requires an authenticated client, a selected workspaceId, a selected workspace record, and that the workspace passes isAgentContextDiagnosticsWorkspaceAllowed (e.g., a connected workspace type eligible for diagnostics). Any missing precondition aborts before collectAgentContextDiagnosticObservations.
Source
Thrown at apps/app/src/react-app/shell/settings-route.tsx:2169
cloudSession.baseUrl,
cloudSession.isSignedIn,
cloudSession.user?.id,
diagnosticsClient,
diagnosticsWorkspaceType,
runtimeWorkspaceId,
selectedWorkspaceEndpoint?.token,
token,
]);
const runAgentContextDiagnostics = useCallback(async () => {
const client = selectedWorkspaceEndpoint?.client ?? openworkClient;
const workspaceId = runtimeWorkspaceId?.trim() ?? "";
if (
!client
|| !workspaceId
|| !selectedWorkspace
|| !isAgentContextDiagnosticsWorkspaceAllowed(selectedWorkspace)
) {
throw new Error("Agent diagnostics require a connected workspace.");
}
const observations = await collectAgentContextDiagnosticObservations({
organizationConnections: orgMcpConnections.connections,
organizationConnectionsProbe,
workspaceType: selectedWorkspace.workspaceType,
});
return client.runAgentContextDiagnostics(workspaceId, observations);
}, [
openworkClient,
organizationConnectionsProbe,
orgMcpConnections.connections,
runtimeWorkspaceId,
selectedWorkspace,
selectedWorkspaceEndpoint,
]);
const routeOpenworkStatus = openworkClient ? "connected" : "disconnected";
const notFoundRouteError = !loading && routeWorkspaceId && !selectedWorkspace
? "Workspace was not found. Select a new workspace from the sidebar."View on GitHub (pinned to 2b7df46e8a)
Solutions
- Select a connected workspace in Settings before opening agent diagnostics.
- Reconnect the OpenWork server so a client instance exists.
- Verify the selected workspace passes isAgentContextDiagnosticsWorkspaceAllowed (check its workspaceType); switch to an allowed workspace.
Example fix
// before
const observations = await collectAgentContextDiagnosticObservations({...});
// after
if (!client || !workspaceId || !selectedWorkspace) return null;
const observations = await collectAgentContextDiagnosticObservations({...}); Defensive patterns
Strategy: validation
Validate before calling
const ready = Boolean(client && workspaceId && selectedWorkspace && isAgentContextDiagnosticsWorkspaceAllowed(selectedWorkspace)); if (!ready) return null; // render 'select a workspace' state instead of running diagnostics
Type guard
function diagnosticsReady(ws: WorkspaceInfo | null, c: unknown, id: string | null)
: ws is WorkspaceInfo {
return c !== null && typeof id === "string" && ws !== null
&& isAgentContextDiagnosticsWorkspaceAllowed(ws);
} Try / catch
try {
await runAgentDiagnostics();
} catch (e) {
if (e instanceof Error && e.message === "Agent diagnostics require a connected workspace.") {
setDiagnosticsUiState("needs-workspace");
} else throw e;
} Prevention
- Gate the diagnostics panel on canInspect like conditions (client && selectedWorkspaceId && allowed).
- Re-check client liveness before each diagnostics run.
- Restrict the workspace selector to diagnostics-allowed types.
- Handle server disconnects by resetting selection state.
When it happens
Trigger: Opening/refreshing the agent diagnostics panel while no workspace is selected, the OpenWork client is null (server disconnected), or the selected workspace's type is not allowed for agent-context diagnostics (e.g., disconnected or unsupported workspace kind).
Common situations: Landing on Settings before choosing a workspace; server dropped so `client` became null; selecting a workspace type excluded from diagnostics allow-list.
Related errors
- Select a workspace to inspect runtime config.
- Cannot create a task without a selected workspace.
- app.error_compact_empty
- Workspace path is unavailable; attachments could not be copi
- Workspace endpoint is unavailable; attachments could not be
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/fd5406af191a22e2.
Report an issue: GitHub.