stablyai/orca · error · RuntimeClientError

invalid_argument

invalid_argument

Error message

Choose either --parent-worktree or --no-parent, not both.

What it means

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.

Source

Thrown at src/cli/handlers/worktree.ts:63

}

function printHookWarning(result: HookWarningResult, json: boolean): void {
  if (!json && result.warning) {
    console.error(`warning: ${result.warning}`)
  }
}

function printPreservedBranchWarning(result: PreservedBranchResult, json: boolean): void {
  if (!json && result.preservedBranch) {
    console.error(
      `warning: local branch "${result.preservedBranch.branchName}" was kept because Git could not safely delete it`
    )
  }
}

function assertParentWorktreeFlagsCompatible(flags: Map<string, string | boolean>): void {
  if (flags.has('parent-worktree') && flags.get('no-parent') === true) {
    throw new RuntimeClientError(
      'invalid_argument',
      'Choose either --parent-worktree or --no-parent, not both.'
    )
  }
  const parentWorktree = flags.get('parent-worktree')
  if (
    flags.has('parent-worktree') &&
    (typeof parentWorktree !== 'string' || parentWorktree === '')
  ) {
    throw new RuntimeClientError('invalid_argument', 'Missing required --parent-worktree')
  }
}

function getEnvParentWorkspace(): string | undefined {
  const workspaceId = process.env.ORCA_WORKSPACE_ID
  if (typeof workspaceId === 'string' && isWorkspaceKey(workspaceId)) {
    return workspaceId
  }

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Remove --no-parent if you intend to set a specific parent worktree.
  2. Remove --parent-worktree if you want the new worktree to have no parent.
  3. Audit your shell aliases and scripts for flags injected from multiple sources.

Example fix

# before
orca worktree create --parent-worktree ../main --no-parent
# after
orca worktree create --parent-worktree ../main
Defensive patterns

Strategy: validation

Validate before calling

// Reject contradictory parent-worktree flags before calling the handler:
if (flags.has('parent-worktree') && flags.get('no-parent') === true) {
  throw new Error('Cannot use --parent-worktree and --no-parent together');
}

Type guard

function areParentFlagsCompatible(flags: Map<string, string | boolean>): boolean {
  return !(flags.has('parent-worktree') && flags.get('no-parent') === true);
}

Try / catch

try {
  assertParentWorktreeFlagsCompatible(flags);
} catch (e) {
  if (e instanceof RuntimeClientError) {
    console.error(e.message);
    process.exit(1);
  }
  throw e;
}

Prevention

When it happens

Trigger: Running 'orca worktree create --parent-worktree ../main --no-parent'. The check is flags.has('parent-worktree') && flags.get('no-parent') === true.

Common situations: Copy-pasting flags from two different examples, CI scripts that accumulate flags, shell aliases that inject --no-parent alongside a manual --parent-worktree.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/f5f8b5505fd26c73. Report an issue: GitHub.