stablyai/orca · error · RuntimeClientError

invalid_argument

invalid_argument

Error message

`--${flag}` does not retarget `${command}`. Run it on the host whose accounts you want to manage.

What it means

Thrown by rejectRemoteSelectionFlags when an account command is invoked with --environment or --pairing-code. Account commands are deliberately pinned to the local runtime (shouldIgnoreRemoteSelection), so honoring those flags would silently target a different host than the user named — exactly the mis-targeting the feature exists to prevent. The throw is intentional fail-loud behavior, not a bug.

Source

Thrown at src/cli/handlers/account.ts:265

      return client.call<CodexRateLimitAccountsState>('accounts.addCodexFromHome', {
        sourceHome: codexHome
      })
    }
  )
  printResult(result, json, (state) => formatAccountsBlock('Codex', state))
}

/**
 * Rejects the runtime-selector flags instead of ignoring them. shouldIgnoreRemoteSelection
 * pins account commands to the local runtime, so honoring `--environment homelab`
 * silently would target the laptop rather than the host the user named — the exact
 * mistake this feature exists to avoid. A `--help` note does not reach someone who
 * already typed the flag.
 */
function rejectRemoteSelectionFlags(ctx: HandlerContext, command: string): void {
  for (const flag of ['environment', 'pairing-code']) {
    if (ctx.flags.has(flag)) {
      throw new RuntimeClientError(
        'invalid_argument',
        `\`--${flag}\` does not retarget \`${command}\`. Run it on the host whose accounts you want to manage.`
      )
    }
  }
}

async function assertAccountImportSupported({ client }: HandlerContext): Promise<void> {
  const status = await client.call<RuntimeStatus>('status.get')
  if (!status.result.capabilities?.includes(ACCOUNT_IMPORT_RUNTIME_CAPABILITY)) {
    throw new RuntimeClientError(
      'incompatible_runtime',
      'The running Orca runtime is too old to add accounts from the CLI. Update or restart Orca and try again.'
    )
  }
}

/** CLI handlers for `orca account add [--agent claude|codex]` and `orca account list`. */

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Drop --environment and --pairing-code from account commands.
  2. Run the account command directly on the host whose accounts you want to manage (SSH in first).
  3. Remove unconditional flag injection in wrapper scripts that target account subcommands.

Example fix

# before
orca account add --agent claude --environment homelab

# after
ssh homelab -- orca account add --agent claude
Defensive patterns

Strategy: validation

Validate before calling

function stripRemoteSelectionFlags(flags: Map<string, string | boolean>): Map<string, string | boolean> {
  const next = new Map(flags)
  next.delete('environment')
  next.delete('pairing-code')
  return next
}

Type guard

function isLocalAccountCommand(flags: Map<string, string | boolean>): boolean {
  return !flags.has('environment') && !flags.has('pairing-code')
}

Prevention

When it happens

Trigger: Calling 'account add' or 'account list' with ctx.flags containing 'environment' or 'pairing-code' (any value, including boolean true).

Common situations: User copies a remote-runtime command pattern onto an account command (`orca account add --environment homelab`), assuming it routes remotely. Or a wrapper script always injects --environment.

Related errors


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