{"record":{"id":"d75b8a7d17ba3a4a","repo":"plandex-ai/plandex","slug":"no-api-keys-credentials-provided-for-models","errorCode":null,"errorMessage":"No api keys/credentials provided for models","messagePattern":"No api keys/credentials provided for models","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"app/server/handlers/client_helper.go","lineNumber":74,"sourceCode":"\tif apiErr != nil {\n\t\tlog.Printf(\"Error getting integrated models: %v\\n\", apiErr)\n\t\thttp.Error(w, \"Error getting integrated models\", http.StatusInternalServerError)\n\t\treturn initClientsResult{}\n\t}\n\n\tif hookResult.GetIntegratedModelsResult != nil && hookResult.GetIntegratedModelsResult.IntegratedModelsMode {\n\t\tmerged := map[string]string{}\n\t\tfor k, v := range hookResult.GetIntegratedModelsResult.AuthVars {\n\t\t\tmerged[k] = v\n\t\t}\n\t\tif authVars[shared.AnthropicClaudeMaxTokenEnvVar] != \"\" {\n\t\t\tmerged[shared.AnthropicClaudeMaxTokenEnvVar] = authVars[shared.AnthropicClaudeMaxTokenEnvVar]\n\t\t}\n\t\tauthVars = merged\n\t}\n\tif len(authVars) == 0 && os.Getenv(\"IS_CLOUD\") != \"\" {\n\t\tlog.Println(\"No api keys/credentials provided for models\")\n\t\thttp.Error(w, \"No api keys/credentials provided for models\", http.StatusBadRequest)\n\t\treturn initClientsResult{}\n\t}\n\n\tclients := model.InitClients(authVars, settings, orgUserConfig)\n\n\treturn initClientsResult{\n\t\tclients:  clients,\n\t\tauthVars: authVars,\n\t}\n}\n","sourceCodeStart":56,"sourceCodeEnd":85,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/handlers/client_helper.go#L56-L85","documentation":"initClients returns HTTP 400 'No api keys/credentials provided for models' when authVars is empty AND the server runs in cloud mode (IS_CLOUD env set). In cloud mode, users must supply model credentials (or use integrated models); without any, LLM clients cannot be initialized, so the request is rejected as a client configuration problem. Self-hosted (IS_CLOUD unset) deployments skip this check.","triggerScenarios":"Tell/Build/Apply plan or loadContexts requests in cloud deployments when: the user/org has no stored API keys or integrated models, the client sends an empty authVars map, or deprecated apiKeys field is omitted and integrated models are not enabled.","commonSituations":"New user account with no model credentials configured yet; API client upgraded to the authVars flow while still sending nothing; org integration revoked leaving authVars empty after the hook merge; keys stored under wrong env var names so the map ends up empty.","solutions":["Configure model API keys/credentials for your account or org (dashboard integrations settings)","Ensure the client sends authVars with at least one valid credential in the request","Verify integrated models are enabled so the hook supplies authVars","If self-hosting, confirm IS_CLOUD is set only when the cloud credential requirement is intended"],"exampleFix":"// before\nreq := shared.TellPlanRequest{} // no authVars\n// after\nreq := shared.TellPlanRequest{\n    AuthVars: map[string]string{\"OPENAI_API_KEY\": os.Getenv(\"OPENAI_API_KEY\")},\n}","handlingStrategy":"validation","validationCode":"// client: ensure credentials exist before invoking plan operations\nif len(authVars) == 0 {\n    return errors.New(\"configure model API keys in settings before running plans\")\n}","typeGuard":"func hasCredentials(authVars map[string]string) bool {\n    for _, v := range authVars { if v != \"\" { return true } }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Configure org/user API keys or integrated models before first use","Always populate authVars in API requests on cloud deployments","After revoking an integration, add a replacement credential source","Only set IS_CLOUD on deployments where enforced credentials are intended"],"tags":["authentication","api-key","http-400","cloud","configuration"],"backgroundTag":"missing-api-key","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}