{"record":{"id":"bf75d3a6fbec2340","repo":"can1357/oh-my-pi","slug":"no-api-key-for-resolved-model-provider-resolv","errorCode":null,"errorMessage":"No API key for ${resolved.model.provider}/${resolved.model.id}","messagePattern":"No API key for (.+?)/(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/main.ts","lineNumber":1280,"sourceCode":"\t\t} else {\n\t\t\toptions.prewalk = { target: resolved.model, thinkingLevel: resolved.thinkingLevel };\n\t\t}\n\t}\n\n\tif (parsed.planYoloInto !== undefined && !parsed.planYolo) {\n\t\tthrow new Error(\"--plan-yolo-into requires --plan-yolo\");\n\t}\n\tif (parsed.planYolo) {\n\t\tconst rolePattern = expandRoleAlias(parsed.planYoloInto ?? \"@smol\", activeSettings);\n\t\tconst resolved = resolveCliModel({ cliModel: rolePattern, modelRegistry, preferences: modelMatchPreferences });\n\t\tif (resolved.warning) {\n\t\t\tprocess.stderr.write(`${chalk.yellow(`Warning: ${resolved.warning}`)}\\n`);\n\t\t}\n\t\tif (resolved.error || !resolved.model) {\n\t\t\tthrow new Error(resolved.error ?? `Model \"${parsed.planYoloInto ?? \"@smol\"}\" not found`);\n\t\t}\n\t\tif (!modelRegistry.hasConfiguredAuth(resolved.model)) {\n\t\t\tthrow new Error(`No API key for ${resolved.model.provider}/${resolved.model.id}`);\n\t\t}\n\t\toptions.planYolo = { target: resolved.model, thinkingLevel: resolved.thinkingLevel };\n\t}\n\n\t// Thinking level\n\tif (parsed.thinking) {\n\t\toptions.thinkingLevel = parsed.thinking;\n\t} else if (\n\t\tscopedModels.length > 0 &&\n\t\tscopedModels[0].explicitThinkingLevel === true &&\n\t\t// A deferred default role resolves its own model (and any explicit\n\t\t// thinking suffix) after extensions register; seeding the fallback\n\t\t// scoped model's level here would override it in createAgentSession.\n\t\t!deferredDefaultRole &&\n\t\t!restoringSession\n\t) {\n\t\toptions.thinkingLevel = scopedModels[0].thinkingLevel;\n\t}","sourceCodeStart":1262,"sourceCodeEnd":1298,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/main.ts#L1262-L1298","documentation":"Once the plan-YOLO target model resolves, main.ts checks `modelRegistry.hasConfiguredAuth(resolved.model)`. If no API key/credential is configured for that model's provider, it throws with `provider/id`. This fails fast at startup so YOLO mode never begins with a model it cannot call.","triggerScenarios":"`--plan-yolo [--plan-yolo-into <model>]` resolving to a valid model whose provider has no credentials (no env var key, no auth.json entry, no OAuth login).","commonSituations":"Fresh machine without provider setup; targeting a provider you don't use (e.g. `@smol` alias points at a provider lacking a key); expired/rotated API key removed from config; CI lacking the secret env var.","solutions":["Set the API key for the resolved provider (e.g. export ANTHROPIC_API_KEY=... / OPENAI_API_KEY=...) or run the provider login flow.","Point `--plan-yolo-into` at a model whose provider credentials you already have.","Check provider configuration files/env in CI and add the missing secret.","Re-authenticate if the stored credential expired."],"exampleFix":"// before (no key configured)\nomp --plan-yolo --plan-yolo-into @smol\n\n// after\nexport ANTHROPIC_API_KEY=sk-ant-...\nomp --plan-yolo --plan-yolo-into @smol","handlingStrategy":"validation","validationCode":"// Pre-flight credential check per provider\nif (!process.env.ANTHROPIC_API_KEY && !process.env.OPENAI_API_KEY) {\n  throw new Error(\"No provider API key configured; set ANTHROPIC_API_KEY or OPENAI_API_KEY\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runOmp([\"--plan-yolo\", \"--plan-yolo-into\", \"@smol\"]);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith(\"No API key for \")) {\n    console.error(\"Configure credentials for the provider first (env var or login flow).\");\n  } else throw err;\n}","preventionTips":["Set provider keys in shell profile or CI secrets before using plan-yolo.","Point --plan-yolo-into at providers you have actually authenticated.","Re-check credentials after key rotation or on new machines."],"tags":["cli","auth","api-key","configuration"],"backgroundTag":"missing-api-key","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}