{"record":{"id":"22cbdf6324df1e66","repo":"plandex-ai/plandex","slug":"error-getting-server-models-input-v","errorCode":null,"errorMessage":"error getting server models input: %v","messagePattern":"error getting server models input: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/cmd/models.go","lineNumber":107,"sourceCode":"\tArgs:    cobra.MaximumNArgs(1),\n\tRun:     customModelsNotImplemented,\n}\n\nfunc manageCustomModels(cmd *cobra.Command, args []string) {\n\tauth.MustResolveAuthWithOrg()\n\n\tterm.StartSpinner(\"\")\n\n\tvar serverModelsInput *shared.ModelsInput\n\tvar defaultConfig *shared.PlanConfig\n\n\terrCh := make(chan error, 2)\n\n\tgo func() {\n\t\tvar err error\n\t\tserverModelsInput, err = lib.GetServerModelsInput()\n\t\tif err != nil {\n\t\t\terrCh <- fmt.Errorf(\"error getting server models input: %v\", err)\n\t\t\treturn\n\t\t}\n\t\terrCh <- nil\n\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\t\terrCh <- nil\n\t}()\n\n\tfor i := 0; i < 2; i++ {\n\t\terr := <-errCh\n\t\tif err != nil {","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/cmd/models.go#L89-L125","documentation":"The `plandex models custom` command fetches the server's models input in a goroutine via lib.GetServerModelsInput() and reports failures over an errCh channel as 'error getting server models input: %v'. GetServerModelsInput combines the server's available models with any user custom model config; it fails if the underlying API call fails or the custom models file/config cannot be read or parsed.","triggerScenarios":"Running `plandex models custom` when lib.GetServerModelsInput() returns an error: the ListAvailableModels API call fails (server unreachable, expired auth), or local custom model config is missing/malformed and cannot be merged into the server models input.","commonSituations":"Invalid JSON in a custom models config file the user edited by hand; referencing an unknown provider or role in custom config; expired session or unreachable Plandex server; version mismatch where server models spec is newer than the CLI expects.","solutions":["Validate the custom models config JSON (e.g. with `jq . <file>` or `plandex models custom --file <path>` after fixing) and correct syntax/schema errors.","Fix the underlying error printed inside the message: re-authenticate for 401s, check server connectivity/daemon for network errors.","Temporarily run `plandex models available` to confirm the server model list endpoint works independently of custom config.","Update the CLI and server to matching versions if a models-spec mismatch is reported."],"exampleFix":"// before (custom models JSON)\n{\"models\": [{\"name\": \"gpt-x\", \"provider\": \"openai\"}]}\n// after — role is required and provider must be known\n{\"models\": [{\"name\": \"gpt-x\", \"provider\": \"openai\", \"role\": \"plan\"}]}","handlingStrategy":"validation","validationCode":"# validate custom models JSON before running the command\nFILE=~/.plandex/custom_models.json\njq empty \"$FILE\" && echo \"config valid\" || echo \"fix JSON syntax in $FILE\"","typeGuard":"func validModelsInput(in *shared.ModelsInput) bool {\n    return in != nil && len(in.Models) > 0\n}","tryCatchPattern":"serverModelsInput, err := lib.GetServerModelsInput()\nif err != nil {\n    var apiErr *shared.ApiError\n    if errors.As(err, &apiErr) && apiErr.Status == 401 {\n        // prompt re-auth and retry once\n    }\n    term.OutputErrorAndExit(fmt.Sprintf(\"server models input unavailable: %v\", err))\n}","preventionTips":["Run `jq empty` (or Go json.Unmarshal) on any hand-edited custom models file before use","Only reference providers, roles, and model fields supported by your CLI/server version","Confirm `plandex models available` works before assuming the problem is your custom config","Keep CLI and server versions in sync to avoid models-spec incompatibilities"],"tags":["cli","config","network","go"],"backgroundTag":"invalid-config-file","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"}