{"record":{"id":"115392f00d508ea1","repo":"plandex-ai/plandex","slug":"error-telling-plan","errorCode":null,"errorMessage":"Error telling plan: ","messagePattern":"Error telling plan: ","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"app/server/handlers/plans_exec.go","lineNumber":110,"sourceCode":"\t\t\tauthVars:      requestBody.AuthVars,\n\t\t\tplan:          plan,\n\t\t\tsettings:      settings,\n\t\t\torgUserConfig: orgUserConfig,\n\t\t},\n\t)\n\terr = modelPlan.Tell(modelPlan.TellParams{\n\t\tClients:  res.clients,\n\t\tPlan:     plan,\n\t\tBranch:   branch,\n\t\tAuth:     auth,\n\t\tReq:      &requestBody,\n\t\tAuthVars: res.authVars,\n\t})\n\n\tif err != nil {\n\t\tlog.Printf(\"Error telling plan: %v\\n\", err)\n\t\tgo notify.NotifyErr(notify.SeverityError, fmt.Errorf(\"error telling plan: %v\", err))\n\t\thttp.Error(w, \"Error telling plan: \"+err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif requestBody.ConnectStream {\n\t\tstartResponseStream(r.Context(), w, auth, planId, branch, false)\n\t}\n\n\tlog.Println(\"Successfully processed request for TellPlanHandler\")\n}\n\nfunc BuildPlanHandler(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"Received request for BuildPlanHandler\", \"ip:\", host.Ip)\n\tauth := Authenticate(w, r, true)\n\tif auth == nil {\n\t\treturn\n\t}\n\n\tvars := mux.Vars(r)","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/handlers/plans_exec.go#L92-L128","documentation":"This wraps any error returned by modelPlan.Tell when executing the plan's tell operation (starting the LLM-driven plan iteration). The handler responds 500 'Error telling plan: <detail>' with the underlying error text appended, and reports it asynchronously. The appended detail is the key to diagnosing the real cause (model client init, stream start, or plan state).","triggerScenarios":"POST to the tell-plan endpoint where modelPlan.Tell fails: invalid/missing API keys passed in requestBody.ApiKeys, unresolvable model provider config from orgUserConfig, an active plan already running on the branch, or internal errors while launching the plan loop.","commonSituations":"Expired or wrong OpenAI/Anthropic API key supplied per-request; org-level model config pointing at a disabled model; attempting to tell a plan that is already active on the same branch; provider outage surfacing through the model client.","solutions":["Read the appended detail after 'Error telling plan: ' in the response/log — it contains the root cause.","Verify the API keys (request ApiKeys or server env) are valid and have quota for the configured model provider.","Ensure no other tell/build is already active on that plan+branch (connect/stop or wait for the current run to finish).","Check org user config model settings; reset to defaults if a custom model name/provider is misconfigured.","Retry after a provider outage; if persistent, upgrade server and CLI to matching versions."],"exampleFix":"// before: per-request key that may be stale\ncurl -X POST .../tell -d '{\"apiKeys\":{\"OPENAI_API_KEY\":\"sk-expired\"}}'\n// after: rely on validated server-side key or refresh first\nexport OPENAI_API_KEY=sk-valid\ncurl -X POST .../tell -d '{}'","handlingStrategy":"try-catch","validationCode":"// verify provider credentials before calling tell\nif os.Getenv(\"OPENAI_API_KEY\") == \"\" && len(req.ApiKeys) == 0 {\n    return errors.New(\"no model API key available\")\n}","typeGuard":null,"tryCatchPattern":"if err := modelPlan.Tell(params); err != nil {\n    if strings.Contains(err.Error(), \"401\") || strings.Contains(err.Error(), \"invalid api key\") {\n        return fmt.Errorf(\"refresh credentials: %w\", err)\n    }\n    if isActivePlanErr(err) { return stopAndWaitThenRetry() }\n    return err\n}","preventionTips":["Rotate and validate provider API keys before they expire.","Ensure only one tell/build runs per plan+branch.","Keep org model config within the provider's supported model list.","Read the full 'Error telling plan: <detail>' message before escalating."],"tags":["llm","plan-execution","server-error","api-keys"],"backgroundTag":"llm-request-failed","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}