{"record":{"id":"2c92837d54fda30b","repo":"stablyai/orca","slug":"invalid-environment","errorCode":"invalid_environment","errorMessage":"orca claude-teams must be run inside an Orca terminal.","messagePattern":"orca claude-teams must be run inside an Orca terminal\\.","errorType":"exception","errorClass":"RuntimeClientError","httpStatus":null,"severity":"error","filePath":"src/cli/handlers/core.ts","lineNumber":70,"sourceCode":"  }\n  const port = Number(rawPort)\n  if (!Number.isInteger(port) || port < 0 || port > 65535) {\n    throw new RuntimeClientError('invalid_argument', `Invalid --port value: ${rawPort}`)\n  }\n  return rawPort\n}\n\nexport const CORE_HANDLERS: Record<string, CommandHandler> = {\n  'claude-teams': async ({ client, rawArgs }) => {\n    if (process.platform === 'win32') {\n      throw new RuntimeClientError(\n        'unsupported_platform',\n        'Claude Agent Teams native panes are not supported on Windows.'\n      )\n    }\n    const paneKey = process.env.ORCA_PANE_KEY\n    if (!paneKey) {\n      throw new RuntimeClientError(\n        'invalid_environment',\n        'orca claude-teams must be run inside an Orca terminal.'\n      )\n    }\n    const response = await client.call<{ launch: { env: Record<string, string> } }>(\n      'agentTeams.prepareLaunch',\n      {\n        paneKey,\n        env: envRecord()\n      }\n    )\n    process.exitCode = await runClaudeAgentTeams(\n      {\n        ...envRecord(),\n        ...response.result.launch.env\n      },\n      rawArgs ?? []\n    )","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/cli/handlers/core.ts#L52-L88","documentation":"The claude-teams handler (core.ts:70) requires the ORCA_PANE_KEY environment variable, which Orca exports only inside its own managed terminal panes. The variable identifies the pane to agentTeams.prepareLaunch; without it the command has no pane context and throws invalid_environment before the RPC.","triggerScenarios":"Running `orca claude-teams ...` from a system terminal, an editor's integrated terminal, or an SSH session that is not an Orca pane (ORCA_PANE_KEY unset).","commonSituations":"Testing the subcommand from a plain shell; SSH-ing into a remote that is not the Orca host; a wrapper that sanitizes env and dropped ORCA_PANE_KEY; running inside a container without the Orca pane env.","solutions":["Run the command inside an Orca terminal pane, which sets ORCA_PANE_KEY automatically","If scripting within an existing pane, ensure ORCA_PANE_KEY is preserved (do not env-scrub it)","For remote/SSH use, connect through Orca's remote session so the pane env is present"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function assertInsideOrcaPane() {\n  if (!process.env.ORCA_PANE_KEY) {\n    throw new Error('orca claude-teams must be run inside an Orca terminal')\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only invoke claude-teams from within an Orca pane that exports ORCA_PANE_KEY","Do not sanitize env in wrapper scripts in a way that drops ORCA_PANE_KEY","For remote use, connect through Orca's remote session so the pane env is present"],"tags":["cli","claude-teams","environment"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}