{"record":{"id":"40b6f800c6178a86","repo":"different-ai/openwork","slug":"message-40b6f8","errorCode":null,"errorMessage":"${message}","messagePattern":"\\$\\{message\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/app/src/react-app/shell/desktop-local-openwork.ts","lineNumber":206,"sourceCode":"\n    recordInspectorEvent(\"route.local_openwork.ensure.success\", {\n      route: options.route,\n      workspaceId: workspace.id,\n      workspaceRoot,\n      baseUrl: info.baseUrl,\n    });\n\n    return info;\n  } catch (error) {\n    const message = describeError(error);\n    console.error(`[${options.route}-route] local workspace reconnect failed`, error);\n    recordInspectorEvent(\"route.local_openwork.ensure.error\", {\n      route: options.route,\n      workspaceId: workspace.id,\n      workspaceRoot,\n      message,\n    });\n    throw new Error(message);\n  }\n}\n","sourceCodeStart":188,"sourceCodeEnd":209,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/app/src/react-app/shell/desktop-local-openwork.ts#L188-L209","documentation":"The generic failure exit of ensureDesktopLocalOpenworkConnection: after recording an inspector event ('route.local_openwork.ensure.error') with the failure message, it rethrows `new Error(message)`. It surfaces whatever specific reason (including the not-ready error above) prevented establishing the local OpenWork connection for the given route/workspace.","triggerScenarios":"Any inner failure of ensureDesktopLocalOpenworkConnection — server info not ready, missing token, workspaceRoot resolution failure — reaches this final throw and propagates to callers (useWorkspaceRouteState, handleCreateWorkspace, SettingsRouteContent).","commonSituations":"Same root causes as the underlying failure (slow/crashed local server, bad workspace state); users see the message verbatim in route or settings error surfaces.","solutions":["Read the recorded inspector event 'route.local_openwork.ensure.error' for the concrete underlying message.","Fix the underlying cause (restart server / re-auth / fix workspace root) and retry.","Wrap the call site to show a retry affordance rather than a dead end."],"exampleFix":"// before\nthrow new Error(message);\n// after — attach cause for easier diagnosis\nthrow new Error(message, { cause: underlyingError });","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await ensureDesktopLocalOpenworkConnection(options);\n} catch (error) {\n  setRouteError(error.message); // surface with retry action\n  // diagnose via recorded inspector event 'route.local_openwork.ensure.error'\n}","preventionTips":["Always attach the underlying cause when rethrowing (Error cause).","Show users a retry affordance for local-server ensure failures.","Record inspector events (already done here) and check them first when debugging."],"tags":["local-server","error-propagation","desktop"],"backgroundTag":"server-not-ready","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}