{"record":{"id":"f5f8b5505fd26c73","repo":"stablyai/orca","slug":"invalid-argument-f5f8b5","errorCode":"invalid_argument","errorMessage":"Choose either --parent-worktree or --no-parent, not both.","messagePattern":"Choose either --parent-worktree or --no-parent, not both\\.","errorType":"exception","errorClass":"RuntimeClientError","httpStatus":null,"severity":"error","filePath":"src/cli/handlers/worktree.ts","lineNumber":63,"sourceCode":"}\n\nfunction printHookWarning(result: HookWarningResult, json: boolean): void {\n  if (!json && result.warning) {\n    console.error(`warning: ${result.warning}`)\n  }\n}\n\nfunction printPreservedBranchWarning(result: PreservedBranchResult, json: boolean): void {\n  if (!json && result.preservedBranch) {\n    console.error(\n      `warning: local branch \"${result.preservedBranch.branchName}\" was kept because Git could not safely delete it`\n    )\n  }\n}\n\nfunction assertParentWorktreeFlagsCompatible(flags: Map<string, string | boolean>): void {\n  if (flags.has('parent-worktree') && flags.get('no-parent') === true) {\n    throw new RuntimeClientError(\n      'invalid_argument',\n      'Choose either --parent-worktree or --no-parent, not both.'\n    )\n  }\n  const parentWorktree = flags.get('parent-worktree')\n  if (\n    flags.has('parent-worktree') &&\n    (typeof parentWorktree !== 'string' || parentWorktree === '')\n  ) {\n    throw new RuntimeClientError('invalid_argument', 'Missing required --parent-worktree')\n  }\n}\n\nfunction getEnvParentWorkspace(): string | undefined {\n  const workspaceId = process.env.ORCA_WORKSPACE_ID\n  if (typeof workspaceId === 'string' && isWorkspaceKey(workspaceId)) {\n    return workspaceId\n  }","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/cli/handlers/worktree.ts#L45-L81","documentation":"Thrown by assertParentWorktreeFlagsCompatible when both --parent-worktree and --no-parent are present simultaneously. These flags specify contradictory parent-worktree behavior: --parent-worktree selects a specific parent, while --no-parent declares no parent at all.","triggerScenarios":"Running 'orca worktree create --parent-worktree ../main --no-parent'. The check is flags.has('parent-worktree') && flags.get('no-parent') === true.","commonSituations":"Copy-pasting flags from two different examples, CI scripts that accumulate flags, shell aliases that inject --no-parent alongside a manual --parent-worktree.","solutions":["Remove --no-parent if you intend to set a specific parent worktree.","Remove --parent-worktree if you want the new worktree to have no parent.","Audit your shell aliases and scripts for flags injected from multiple sources."],"exampleFix":"# before\norca worktree create --parent-worktree ../main --no-parent\n# after\norca worktree create --parent-worktree ../main","handlingStrategy":"validation","validationCode":"// Reject contradictory parent-worktree flags before calling the handler:\nif (flags.has('parent-worktree') && flags.get('no-parent') === true) {\n  throw new Error('Cannot use --parent-worktree and --no-parent together');\n}","typeGuard":"function areParentFlagsCompatible(flags: Map<string, string | boolean>): boolean {\n  return !(flags.has('parent-worktree') && flags.get('no-parent') === true);\n}","tryCatchPattern":"try {\n  assertParentWorktreeFlagsCompatible(flags);\n} catch (e) {\n  if (e instanceof RuntimeClientError) {\n    console.error(e.message);\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["Decide parent strategy once per script and use only the corresponding flag.","Audit aliases that inject --no-parent automatically.","Test flag combinations in isolation before composing complex commands."],"tags":["cli","worktree","flag-validation","mutually-exclusive"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}