{"record":{"id":"0d480ae68ff857ca","repo":"plandex-ai/plandex","slug":"error-getting-integrated-models","errorCode":null,"errorMessage":"Error getting integrated models","messagePattern":"Error getting integrated models","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"app/server/handlers/client_helper.go","lineNumber":58,"sourceCode":"\t\tauthVars = params.authVars\n\t} else if params.apiKeys != nil {\n\t\tauthVars = map[string]string{}\n\t\tfor envVar, apiKey := range params.apiKeys {\n\t\t\tauthVars[envVar] = apiKey\n\t\t}\n\t\tif params.openAIOrgId != \"\" {\n\t\t\tauthVars[\"OPENAI_ORG_ID\"] = params.openAIOrgId\n\t\t}\n\t}\n\n\thookResult, apiErr := hooks.ExecHook(hooks.GetIntegratedModels, hooks.HookParams{\n\t\tAuth: params.auth,\n\t\tPlan: params.plan,\n\t})\n\n\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}","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/handlers/client_helper.go#L40-L76","documentation":"initClients executes the getIntegratedModels hook (hooks.ExecHook) to resolve integrated-model credentials and returns HTTP 500 'Error getting integrated models' if the hook returns an error. On cloud deployments this hook typically calls an external service/DB to fetch org-integrated model auth; failure here blocks any plan operation that needs LLM clients.","triggerScenarios":"Any handler path through initClients (loadContexts, ApplyPlanHandler, TellPlanHandler, BuildPlanHandler) when the integrated-models hook errors — its backing store unreachable, the hook's external integration service down, or auth context making the hook's query fail.","commonSituations":"Cloud deployment where the integration service or database behind the hook is down; misconfigured server env for the integrations backend; org's integration credentials revoked causing the hook call to error; network egress blocked from the server to the integration service.","solutions":["Check server logs for the logged apiErr from ExecHook to find the root cause","Verify the integrated-models backing service/database is reachable from the server","Confirm the org's model integrations are configured and credentials valid in the dashboard","Retry the plan operation once the integration service recovers"],"exampleFix":"// before\nhookResult, apiErr := hooks.ExecHook(hooks.GetIntegratedModels, params) // ignored error handling\n// after\nhookResult, apiErr := hooks.ExecHook(hooks.GetIntegratedModels, params)\nif apiErr != nil {\n    return fmt.Errorf(\"get integrated models: %w\", apiErr) // surface root cause to logs/client\n}","handlingStrategy":"retry","validationCode":"// client: preflight that model integrations are configured\nsettings, err := client.GetPlanSettings(planId)\nif err != nil { return err }\nif len(orgIntegratedModels) == 0 && len(authVars) == 0 {\n    return errors.New(\"no model credentials or integrations configured\")\n}","typeGuard":null,"tryCatchPattern":"// retry on 500; surface body for diagnosis\nfor attempt := 0; attempt < 3; attempt++ {\n    resp, err := client.Do(req)\n    if err == nil && resp.StatusCode == 200 { break }\n    time.Sleep(time.Duration(1<<attempt) * time.Second)\n}","preventionTips":["Monitor the integrated-models backend service health","Configure org model integrations before running plan operations","Verify server egress/network to the integration service","Check server logs for the hook's wrapped apiErr on failure"],"tags":["http-500","integration","models","hooks","cloud"],"backgroundTag":"integration-service-unavailable","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"}