{"record":{"id":"7737112189def99c","repo":"stablyai/orca","slug":"invalid-argument-773711","errorCode":"invalid_argument","errorMessage":"Missing value for --worktree.","messagePattern":"Missing value for --worktree\\.","errorType":"exception","errorClass":"RuntimeClientError","httpStatus":null,"severity":"error","filePath":"src/cli/handlers/file.ts","lineNumber":34,"sourceCode":"  staged?: boolean\n  opened: boolean\n  kind?: RuntimeFileOpenResult['kind']\n  skipped?: boolean\n  reason?: string\n}\n\ntype FileOpenChangedResult = {\n  worktree: string\n  mode: OpenChangedMode\n  opened: FileOpenRecord[]\n  skipped: FileOpenRecord[]\n  totalChanged: number\n}\n\nasync function getFileWorktreeSelector({ flags, cwd, client }: HandlerContext): Promise<string> {\n  const worktree = flags.get('worktree')\n  if (flags.has('worktree') && (typeof worktree !== 'string' || worktree.length === 0)) {\n    throw new RuntimeClientError('invalid_argument', 'Missing value for --worktree.')\n  }\n  const explicit = await getOptionalWorktreeSelector(flags, 'worktree', cwd, client)\n  if (explicit) {\n    return explicit\n  }\n  if (client.isRemote) {\n    throw new RuntimeClientError(\n      'invalid_argument',\n      'Remote file commands require --worktree because the client cwd cannot identify a server worktree.'\n    )\n  }\n  return await resolveCurrentWorktreeSelector(cwd, client)\n}\n\nasync function resolveFilePath(\n  ctx: HandlerContext,\n  worktree: string,\n  path: string","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/cli/handlers/file.ts#L16-L52","documentation":"Thrown by getFileWorktreeSelector in file.ts when --worktree is present but has no usable string value. The check is `flags.has('worktree') && (typeof worktree !== 'string' || worktree.length === 0)`: the flag was explicitly passed but is empty or boolean-only. File commands need a worktree selector to scope file operations, so an explicitly empty value is invalid_argument.","triggerScenarios":"Passing `--worktree` with no value, or `--worktree \"\"` (empty string), or `--worktree=` on the command line. The flag's presence triggers the emptiness check.","commonSituations":"Shell variable that is unset expanding to an empty string; a script that conditionally adds --worktree but passes an empty value; typo where the value goes to the next flag.","solutions":["Either omit --worktree entirely (so the CLI resolves the current worktree), or pass a non-empty selector value.","If the value comes from a variable, guard the script to only add --worktree when the variable is non-empty.","Verify the worktree path/id is correct and not accidentally truncated."],"exampleFix":"// before\norca file open-changed --worktree\n// after\norca file open-changed --worktree main\n// or omit it to use the current worktree\norca file open-changed","handlingStrategy":"validation","validationCode":"function resolveWorktreeFlag(flags: Map<string, string | boolean>): string | undefined {\n  if (!flags.has('worktree')) return undefined;\n  const v = flags.get('worktree');\n  if (typeof v === 'string' && v.length > 0) return v;\n  throw new Error('--worktree was passed but is empty; omit it or supply a value');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only add --worktree when the value variable is non-empty.","Prefer omitting the flag to let the CLI infer the current worktree."],"tags":["cli","argument-validation","worktree","file"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}