{"record":{"id":"8301ff5722d2cf78","repo":"stablyai/orca","slug":"invalid-argument-8301ff","errorCode":"invalid_argument","errorMessage":"`--${flag}` does not retarget `${command}`. Run it on the host whose accounts you want to manage.","messagePattern":"`--(.+?)` does not retarget `(.+?)`\\. Run it on the host whose accounts you want to manage\\.","errorType":"exception","errorClass":"RuntimeClientError","httpStatus":null,"severity":"error","filePath":"src/cli/handlers/account.ts","lineNumber":265,"sourceCode":"      return client.call<CodexRateLimitAccountsState>('accounts.addCodexFromHome', {\n        sourceHome: codexHome\n      })\n    }\n  )\n  printResult(result, json, (state) => formatAccountsBlock('Codex', state))\n}\n\n/**\n * Rejects the runtime-selector flags instead of ignoring them. shouldIgnoreRemoteSelection\n * pins account commands to the local runtime, so honoring `--environment homelab`\n * silently would target the laptop rather than the host the user named — the exact\n * mistake this feature exists to avoid. A `--help` note does not reach someone who\n * already typed the flag.\n */\nfunction rejectRemoteSelectionFlags(ctx: HandlerContext, command: string): void {\n  for (const flag of ['environment', 'pairing-code']) {\n    if (ctx.flags.has(flag)) {\n      throw new RuntimeClientError(\n        'invalid_argument',\n        `\\`--${flag}\\` does not retarget \\`${command}\\`. Run it on the host whose accounts you want to manage.`\n      )\n    }\n  }\n}\n\nasync function assertAccountImportSupported({ client }: HandlerContext): Promise<void> {\n  const status = await client.call<RuntimeStatus>('status.get')\n  if (!status.result.capabilities?.includes(ACCOUNT_IMPORT_RUNTIME_CAPABILITY)) {\n    throw new RuntimeClientError(\n      'incompatible_runtime',\n      'The running Orca runtime is too old to add accounts from the CLI. Update or restart Orca and try again.'\n    )\n  }\n}\n\n/** CLI handlers for `orca account add [--agent claude|codex]` and `orca account list`. */","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/cli/handlers/account.ts#L247-L283","documentation":"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.","triggerScenarios":"Calling 'account add' or 'account list' with ctx.flags containing 'environment' or 'pairing-code' (any value, including boolean true).","commonSituations":"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.","solutions":["Drop --environment and --pairing-code from account commands.","Run the account command directly on the host whose accounts you want to manage (SSH in first).","Remove unconditional flag injection in wrapper scripts that target account subcommands."],"exampleFix":"# before\norca account add --agent claude --environment homelab\n\n# after\nssh homelab -- orca account add --agent claude","handlingStrategy":"validation","validationCode":"function stripRemoteSelectionFlags(flags: Map<string, string | boolean>): Map<string, string | boolean> {\n  const next = new Map(flags)\n  next.delete('environment')\n  next.delete('pairing-code')\n  return next\n}","typeGuard":"function isLocalAccountCommand(flags: Map<string, string | boolean>): boolean {\n  return !flags.has('environment') && !flags.has('pairing-code')\n}","tryCatchPattern":null,"preventionTips":["Never inject --environment/--pairing-code into account subcommands.","SSH to the target host and run the account command locally there."],"tags":["cli","account","remote-selection","invalid-argument"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}