{"record":{"id":"450581dfab8679e8","repo":"stablyai/orca","slug":"failed-450581","errorCode":"failed","errorMessage":"Not connected to Linear","messagePattern":"Not connected to Linear","errorType":"error_code","errorClass":"LinearWriteFailure","httpStatus":null,"severity":"error","filePath":"src/main/linear/issues.ts","lineNumber":1178,"sourceCode":"  title: string,\n  description: string | undefined,\n  workspaceId: string,\n  options: {\n    id: string\n    parentId?: string | null\n    projectId?: string | null\n    stateId?: string\n    assigneeId?: string | null\n    priority?: number\n    estimate?: number | null\n    dueDate?: string | null\n    labelIds?: string[]\n    signal?: AbortSignal\n  }\n): Promise<LinearIssueWriteRecord> {\n  const entry = getClients(workspaceId)[0]\n  if (!entry) {\n    throw new LinearWriteFailure('failed', 'Not connected to Linear')\n  }\n\n  return runLinearWrite(entry, options.signal, async (client) => {\n    const result = await client.createIssue({\n      id: options.id,\n      teamId,\n      title,\n      ...(description ? { description } : {}),\n      ...(options.parentId ? { parentId: options.parentId } : {}),\n      ...(options.projectId ? { projectId: options.projectId } : {}),\n      ...(options.stateId ? { stateId: options.stateId } : {}),\n      ...(options.assigneeId !== undefined ? { assigneeId: options.assigneeId } : {}),\n      ...(options.priority !== undefined ? { priority: options.priority } : {}),\n      ...(options.estimate !== undefined ? { estimate: options.estimate } : {}),\n      ...(options.dueDate !== undefined ? { dueDate: options.dueDate } : {}),\n      ...(options.labelIds !== undefined ? { labelIds: options.labelIds } : {})\n    })\n    if (!result.success) {","sourceCodeStart":1160,"sourceCodeEnd":1196,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/linear/issues.ts#L1160-L1196","documentation":"Thrown by createIssueForAgent when getClients(workspaceId)[0] is undefined. The agent-facing create path requires a concrete, connected workspace and aborts with kind='failed' before contacting Linear. This is a precondition failure, distinct from a Linear API rejection.","triggerScenarios":"Invoking createIssueForAgent with a workspaceId that has no loaded token, was disconnected, or whose credentials cannot be decrypted.","commonSituations":"Agent tool ran before the user connected Linear; the selected workspace differs from connected ones; token was cleared after an auth error on a prior call.","solutions":["Pre-check connectivity with getLinearStatus() and require connection before issuing the create call.","Ensure the workspaceId passed is the same id recorded in workspace state.","Handle LinearWriteFailure with kind='failed' to surface a re-auth prompt rather than retrying."],"exampleFix":"// before\nconst rec = await createIssueForAgent(teamId, { title }, workspaceId, { signal })\n// after\nif (!getClients(workspaceId)[0]) throw new Error('Connect Linear first')\nconst rec = await createIssueForAgent(teamId, { title }, workspaceId, { signal })","handlingStrategy":"validation","validationCode":"if (!getClients(workspaceId)[0]) throw new Error('Connect Linear before creating issues')","typeGuard":"function isNotConnectedFailure(e: unknown): boolean {\n  return e instanceof LinearWriteFailure && e.kind === 'failed' && e.message === 'Not connected to Linear'\n}","tryCatchPattern":"try { await createIssueForAgent(teamId, opts, workspaceId, { signal }) }\ncatch (e) { if (isNotConnectedFailure(e)) { await promptConnect(); return } throw e }","preventionTips":["Require a connected status before exposing create actions to the user/agent.","Handle kind==='failed'/'Not connected' as a non-retryable precondition error."],"tags":["linear","authentication","workspace","create","precondition"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}