{"record":{"id":"c9c6468b52fefeae","repo":"ruvnet/ruflo","slug":"no-api-key-for-provider-providername","errorCode":null,"errorMessage":"No API key for provider: ${providerName}","messagePattern":"No API key for provider: (.+?)","errorType":"http","errorClass":null,"httpStatus":401,"severity":"error","filePath":"ruflo/src/mcp-bridge/index.js","lineNumber":1611,"sourceCode":"  const content = detailStore.get(req.params.token);\n  if (content) {\n    res.json({ content });\n  } else {\n    res.status(404).json({ error: 'Detail expired or not found' });\n  }\n});\n\n// =============================================================================\n// CHAT COMPLETIONS PROXY\n// =============================================================================\n\napp.post(\"/chat/completions\", async (req, res) => {\n  const model = req.body?.model;\n  const providerName = resolveProvider(model);\n  const provider = PROVIDER_ROUTES[providerName];\n  const apiKey = provider.getKey();\n\n  if (!apiKey) return res.status(401).json({ error: { message: `No API key for provider: ${providerName}` } });\n\n  // Inject comprehensive system prompt as the first message\n  const body = { ...req.body };\n  if (body.messages && Array.isArray(body.messages)) {\n    let systemPrompt = buildSystemPrompt();\n    // Add autopilot instructions if autopilot mode is active\n    const isAutopilot = req.headers['x-autopilot'] === 'true';\n    if (isAutopilot) {\n      systemPrompt = AUTOPILOT_SYSTEM_PROMPT + '\\n\\n' + systemPrompt;\n    }\n    // Prepend our system prompt before any existing messages\n    const hasSystemMsg = body.messages[0]?.role === \"system\";\n    if (hasSystemMsg) {\n      // Merge with existing system message\n      body.messages = [\n        { role: \"system\", content: systemPrompt + \"\\n\\n\" + body.messages[0].content },\n        ...body.messages.slice(1),\n      ];","sourceCodeStart":1593,"sourceCodeEnd":1629,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/ruflo/src/mcp-bridge/index.js#L1593-L1629","documentation":"POST /chat/completions resolved the model to a provider route, but provider.getKey() returned an empty API key. The proxy has no credentials configured for the target provider (missing environment variable for that provider's key), so it cannot forward the request upstream.","triggerScenarios":"Thrown at ruflo/src/mcp-bridge/index.js:1611 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Configure an API key for the named provider in the bridge's credential store/environment.","Register the provider with valid credentials before making requests."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}