{"record":{"id":"344af46ffeb77aa7","repo":"plandex-ai/plandex","slug":"error-getting-plan-config-v-344af4","errorCode":null,"errorMessage":"error getting plan config: %v","messagePattern":"error getting plan config: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/cmd/set_model.go","lineNumber":187,"sourceCode":"\t}()\n\n\tgo func() {\n\t\tvar apiErr *shared.ApiError\n\t\tdefaultConfig, apiErr = api.Client.GetDefaultPlanConfig()\n\t\tif apiErr != nil {\n\t\t\terrCh <- fmt.Errorf(\"error getting default config: %v\", apiErr.Msg)\n\t\t\treturn\n\t\t}\n\n\t\terrCh <- nil\n\t}()\n\n\tgo func() {\n\t\tif lib.CurrentPlanId != \"\" {\n\t\t\tvar apiErr *shared.ApiError\n\t\t\tplanConfig, apiErr = api.Client.GetPlanConfig(lib.CurrentPlanId)\n\t\t\tif apiErr != nil {\n\t\t\t\terrCh <- fmt.Errorf(\"error getting plan config: %v\", apiErr.Msg)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\terrCh <- nil\n\t}()\n\n\tfor i := 0; i < 3; i++ {\n\t\terr := <-errCh\n\t\tif err != nil {\n\t\t\tterm.OutputErrorAndExit(err.Error())\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tuseJsonFile := setModelUseJsonFile || setModelSave\n\n\tvar nameArg string\n\tif len(args) > 0 {","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/cmd/set_model.go#L169-L205","documentation":"This error wraps a failure from api.Client.GetPlanConfig(lib.CurrentPlanId) in set_model's parallel fetch. It fires only when lib.CurrentPlanId is non-empty, meaning the plan-specific config lookup failed. The *shared.ApiError Msg is embedded into 'error getting plan config: %s'.","triggerScenarios":"CurrentPlanId set (user has an active plan) but GetPlanConfig returns non-nil *shared.ApiError: the plan was deleted or the ID is stale, credentials are invalid/expired, or the server errors on the lookup.","commonSituations":"Stale plan ID cached after the plan was deleted or access revoked on the server; switching orgs without refreshing local state; token expiry.","solutions":["Refresh local plan state (re-login or re-select the plan) so CurrentPlanId points to an existing plan","Check err.Msg for 404 — the plan may have been deleted; clear the stale plan ID","Re-authenticate if the error indicates 401/403","Retry on 5xx; verify network connectivity"],"exampleFix":"// before\nplanConfig, apiErr = api.Client.GetPlanConfig(lib.CurrentPlanId)\nif apiErr != nil {\n\terrCh <- fmt.Errorf(\"error getting plan config: %v\", apiErr.Msg)\n\treturn\n}\n// after\nplanConfig, apiErr = api.Client.GetPlanConfig(lib.CurrentPlanId)\nif apiErr != nil {\n\tif apiErr.Status == 404 {\n\t\tlib.CurrentPlanId = \"\" // clear stale plan and fall back to default config\n\t}\n\terrCh <- fmt.Errorf(\"error getting plan config: %v\", apiErr.Msg)\n\treturn\n}","handlingStrategy":"type-guard","validationCode":"// pre-flight: verify CurrentPlanId is set and the plan still exists\nif lib.CurrentPlanId == \"\" {\n\t// proceed with default config instead\n}\n_, err := api.Client.GetPlanConfig(lib.CurrentPlanId)\nif ae, ok := err.(*shared.ApiError); ok && ae.Status == 404 {\n\tlib.CurrentPlanId = \"\" // clear stale plan reference\n}","typeGuard":"func planExists(id string) bool {\n\t_, err := api.Client.GetPlanConfig(id)\n\tae, ok := err.(*shared.ApiError)\n\treturn err == nil || (ok && ae.Status != 404)\n}","tryCatchPattern":"planConfig, apiErr := api.Client.GetPlanConfig(lib.CurrentPlanId)\nif apiErr != nil {\n\tif apiErr.Status == 404 {\n\t\tlib.CurrentPlanId = \"\"\n\t\tplanConfig, apiErr = api.Client.GetDefaultPlanConfig() // fallback\n\t}\n\tif apiErr != nil {\n\t\treturn fmt.Errorf(\"error getting plan config: %w\", apiErr)\n\t}\n}","preventionTips":["Refresh local plan state after switching orgs or plans","Handle 404 by clearing the stale plan ID and falling back to the default config","Re-authenticate when receiving 401/403","Validate CurrentPlanId against the server after CLI upgrades"],"tags":["go","cli","api","network"],"backgroundTag":"api-request-failed","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"}