{"record":{"id":"b9c64c4543a55a0d","repo":"paperclipai/paperclip","slug":"environment-variable-opts-apikeyenv-trim-is-n","errorCode":null,"errorMessage":"Environment variable ${opts.apiKeyEnv.trim()} is not set","messagePattern":"Environment variable (.+?) is not set","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/prompt.ts","lineNumber":274,"sourceCode":"  if (!matches) {\n    throw new Error(\n      `Agent key belongs to ${agent.name} (${agent.id}), not '${reference}'. Use the matching agent or a board prompt.`,\n    );\n  }\n}\n\nfunction agentSummary(agent: Agent): PromptResult[\"agent\"] {\n  return {\n    id: agent.id,\n    name: agent.name,\n    urlKey: typeof agent.urlKey === \"string\" ? agent.urlKey : null,\n  };\n}\n\nfunction readApiKeyEnvOption(opts: PromptOptions): string | undefined {\n  if (!opts.apiKeyEnv?.trim()) return undefined;\n  const value = process.env[opts.apiKeyEnv.trim()]?.trim();\n  if (!value) throw new Error(`Environment variable ${opts.apiKeyEnv.trim()} is not set`);\n  return value;\n}\n","sourceCodeStart":256,"sourceCodeEnd":277,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/cli/src/commands/client/prompt.ts#L256-L277","documentation":"readApiKeyEnvOption looked up the env var named by --api-key-env and found it unset or empty, so no API key can be sourced from it.","triggerScenarios":"Thrown at cli/src/commands/client/prompt.ts:274 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Export the named environment variable with the API key before running, or pass the key directly."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}