{"record":{"id":"3c0b368f343dfa12","repo":"stablyai/orca","slug":"linear-issue-required","errorCode":"linear_issue_required","errorMessage":"Pass a Linear issue id or --current","messagePattern":"Pass a Linear issue id or --current","errorType":"validation","errorClass":"RuntimeClientError","httpStatus":null,"severity":"error","filePath":"src/cli/linear-request-builders.ts","lineNumber":168,"sourceCode":"    include: includes,\n    depth: clampLinearIssueDepth(requestedDepth),\n    context: buildLinearCurrentContext(cwd, remote)\n  }\n}\n\nexport function buildWriteTargetRequest(\n  flags: Map<string, string | boolean>,\n  cwd: string,\n  remote: boolean\n): LinearWriteTargetRequest {\n  rejectAllWorkspaceForWrite(flags)\n  const input = getOptionalStringFlag(flags, 'id')\n  const current = flags.get('current') === true\n  if (input && current) {\n    throw new RuntimeClientError('invalid_argument', 'Pass either <id> or --current, not both')\n  }\n  if (!input && !current) {\n    throw new RuntimeClientError('linear_issue_required', 'Pass a Linear issue id or --current')\n  }\n  return {\n    input,\n    current,\n    workspaceId: getOptionalStringFlag(flags, 'workspace'),\n    context: buildLinearCurrentContext(cwd, remote)\n  }\n}\n\nexport function buildLinearCurrentContext(\n  cwd: string,\n  remote: boolean\n): LinearIssueRequest['context'] {\n  return {\n    remote,\n    ...(remote ? {} : { cwd }),\n    ...(process.env.ORCA_WORKTREE_ID ? { worktreeId: process.env.ORCA_WORKTREE_ID } : {}),\n    ...(process.env.ORCA_TERMINAL_HANDLE","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/cli/linear-request-builders.ts#L150-L186","documentation":"Thrown by buildWriteTargetRequest when a Linear write operation is given NEITHER an issue `<id>` NOR the `--current` flag. A write must target exactly one issue; with no target the builder cannot proceed. It fires after rejectAllWorkspaceForWrite and before constructing the request payload.","triggerScenarios":"Running a write subcommand with no positional id and no `--current`, e.g. `linear comment --body \"...\"`. Any call into buildWriteTargetRequest where both `input` is falsy and `flags.get('current') !== true`.","commonSituations":"Running a write command outside a git worktree/branch linked to a Linear issue (so `--current` resolves nothing) and forgetting the id. Scripts that conditionally pass an id that ends up empty. CI runners with no Linear branch context.","solutions":["Pass an explicit issue id: `linear comment LIN-123 --body \"...\"`.","Or run from inside a branch whose name/description is linked to a Linear issue and add `--current`.","If scripting, verify the id is non-empty before invoking: `if [ -n \"$ID\" ]; then linear comment \"$ID\" ...; fi`."],"exampleFix":"// before\nlinear comment --body \"fix shipped\"\n// after\nlinear comment LIN-123 --body \"fix shipped\"","handlingStrategy":"validation","validationCode":"const input = flags.get('id')\nconst current = flags.get('current') === true\nif (!input && !current) {\n  throw new Error('Linear write requires an issue id or --current')\n}","typeGuard":"function hasWriteTarget(flags: Map<string, string | boolean>): boolean {\n  return Boolean(flags.get('id')) || flags.get('current') === true\n}","tryCatchPattern":null,"preventionTips":["In CI, assert a Linear context (branch link) exists before running write commands, or require an explicit id.","Fail scripts early when the resolved id is empty rather than passing it through."],"tags":["linear","cli","flag-validation","write-target"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}