{"record":{"id":"ca0907d17065dd51","repo":"stablyai/orca","slug":"invalid-argument-ca0907","errorCode":"invalid_argument","errorMessage":"Choose either one parent selector or --no-parent.","messagePattern":"Choose either one parent selector or --no-parent\\.","errorType":"exception","errorClass":"RuntimeClientError","httpStatus":null,"severity":"error","filePath":"src/cli/handlers/worktree-create-parent-selector.ts","lineNumber":15,"sourceCode":"import { isWorkspaceKey } from '../../shared/workspace-scope'\nimport { getOptionalStringFlag } from '../flags'\nimport { RuntimeClientError, type RuntimeClient } from '../runtime-client'\nimport { getOptionalWorktreeSelector } from '../selectors'\n\nexport type CreateParentSelector = {\n  parentWorktree?: string\n  parentWorkspace?: string\n}\n\nconst CREATE_PARENT_CONFLICT_MESSAGE = 'Choose either one parent selector or --no-parent.'\n\nexport function assertCreateParentFlagsCompatible(flags: Map<string, string | boolean>): void {\n  if (flags.has('parent-worktree') && flags.get('no-parent') === true) {\n    throw new RuntimeClientError('invalid_argument', CREATE_PARENT_CONFLICT_MESSAGE)\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 getWorkspaceKeyParentSelector(selector: string): string | undefined {\n  const rawSelector = selector.startsWith('id:') ? selector.slice('id:'.length) : selector\n  return isWorkspaceKey(rawSelector) ? rawSelector : undefined\n}\n\nexport async function resolveCreateParentSelector(\n  flags: Map<string, string | boolean>,\n  cwd: string,","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/cli/handlers/worktree-create-parent-selector.ts#L1-L33","documentation":"Thrown by assertCreateParentFlagsCompatible when both `--parent-worktree` (any value) and `--no-parent` (boolean true) are supplied to a worktree-create command. The two are mutually exclusive: one names an explicit parent, the other declares no parent at all. The message is shared via the CREATE_PARENT_CONFLICT_MESSAGE constant.","triggerScenarios":"Running `orca worktree create --parent-worktree <x> --no-parent`, or a wrapper that defaults `--no-parent` on while still forwarding a parent selector.","commonSituations":"Script that sets `--no-parent` as a default and also passes through user-provided `--parent-worktree`; UI that exposes both controls and submits both; copy-paste combining two examples.","solutions":["Choose one: either `--parent-worktree <selector>` for an explicit parent, or `--no-parent` for none.","In wrappers, drop `--no-parent` whenever `--parent-worktree` is set, and vice-versa.","If neither is given, Orca applies its default parent resolution."],"exampleFix":"// before\norca worktree create --parent-worktree main --no-parent\n// after\norca worktree create --parent-worktree main\n// or\norca worktree create --no-parent","handlingStrategy":"validation","validationCode":"if (flags.has('parent-worktree') && flags.get('no-parent') === true) {\n  // reject: --parent-worktree and --no-parent are mutually exclusive\n}","typeGuard":"function createParentFlagsCompatible(flags: Map<string, string | boolean>): boolean {\n  return !(flags.has('parent-worktree') && flags.get('no-parent') === true)\n}","tryCatchPattern":"try { await worktreeCreate(flags) }\ncatch (e) {\n  if (e instanceof RuntimeClientError && e.code === 'invalid_argument' && e.message === 'Choose either one parent selector or --no-parent.') {\n    // drop one of the two based on intent, then retry\n  } else throw e\n}","preventionTips":["Model parent selection as a single mode in wrappers, not two independent flags.","Strip --no-parent whenever --parent-worktree is set, and vice-versa.","Add a test asserting the conflict is detected before any create RPC."],"tags":["cli","validation","worktree","conflict","mutually-exclusive","invalid-argument"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}