plandex-ai/plandex · error
error getting server models input: %v
Error message
error getting server models input: %v
What it means
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.
Source
Thrown at app/cli/cmd/models.go:107
Args: cobra.MaximumNArgs(1),
Run: customModelsNotImplemented,
}
func manageCustomModels(cmd *cobra.Command, args []string) {
auth.MustResolveAuthWithOrg()
term.StartSpinner("")
var serverModelsInput *shared.ModelsInput
var defaultConfig *shared.PlanConfig
errCh := make(chan error, 2)
go func() {
var err error
serverModelsInput, err = lib.GetServerModelsInput()
if err != nil {
errCh <- fmt.Errorf("error getting server models input: %v", err)
return
}
errCh <- nil
}()
go func() {
var apiErr *shared.ApiError
defaultConfig, apiErr = api.Client.GetDefaultPlanConfig()
if apiErr != nil {
errCh <- fmt.Errorf("error getting default config: %v", apiErr.Msg)
return
}
errCh <- nil
}()
for i := 0; i < 2; i++ {
err := <-errCh
if err != nil {View on GitHub (pinned to e2d772072e)
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.
Example fix
// before (custom models JSON)
{"models": [{"name": "gpt-x", "provider": "openai"}]}
// after — role is required and provider must be known
{"models": [{"name": "gpt-x", "provider": "openai", "role": "plan"}]} Defensive patterns
Strategy: validation
Validate before calling
# validate custom models JSON before running the command FILE=~/.plandex/custom_models.json jq empty "$FILE" && echo "config valid" || echo "fix JSON syntax in $FILE"
Type guard
func validModelsInput(in *shared.ModelsInput) bool {
return in != nil && len(in.Models) > 0
} Try / catch
serverModelsInput, err := lib.GetServerModelsInput()
if err != nil {
var apiErr *shared.ApiError
if errors.As(err, &apiErr) && apiErr.Status == 401 {
// prompt re-auth and retry once
}
term.OutputErrorAndExit(fmt.Sprintf("server models input unavailable: %v", err))
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- error listing contexts: %v
- error getting context body: %v
- error getting default config: %v
- error getting plan config: %v
- error fetching users: %s
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/22cbdf6324df1e66.
Report an issue: GitHub.