{"record":{"id":"04f67ef9aa03bf7a","repo":"plandex-ai/plandex","slug":"error-getting-server-models-input-v-04f67e","errorCode":null,"errorMessage":"error getting server models input: %v","messagePattern":"error getting server models input: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/lib/custom_models.go","lineNumber":338,"sourceCode":"\t\treturn false\n\t}\n\n\tfmt.Print(added.String())\n\tfmt.Print(updated.String())\n\tfmt.Print(deleted.String())\n\n\treturn true\n}\n\nfunc SyncCustomModels() error {\n\tuserId := auth.Current.UserId\n\tif userId == \"\" {\n\t\treturn fmt.Errorf(\"auth.Current.UserId is empty\")\n\t}\n\n\tserverModelsInput, err := GetServerModelsInput()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error getting server models input: %v\", err)\n\t}\n\n\tMustSyncCustomModels(GetCustomModelsPath(userId), serverModelsInput)\n\n\treturn nil\n}\n","sourceCodeStart":320,"sourceCodeEnd":345,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/lib/custom_models.go#L320-L345","documentation":"SyncCustomModels fetches the server's view of custom models, providers, and model packs via GetServerModelsInput, which fans out three concurrent API calls (ListCustomModels, ListCustomProviders, ListModelPacks). This error wraps the first API failure returned, so it indicates a server/network problem, not a local file problem.","triggerScenarios":"GetServerModelsInput returning an error because any of the three API calls fails — server unreachable, 401/403 due to expired session, server error response, or (non-cloud only) ListCustomProviders failing.","commonSituations":"Server under maintenance or down; VPN/network outage; auth token expired causing API rejection; Plandex server version too old to expose one of the list endpoints.","solutions":["Check the wrapped %v error (err.Msg from the ApiError) for the specific API failure (auth vs network vs server).","Verify connectivity to the Plandex server and that the server is running/reachable.","Re-authenticate if the error indicates 401/403 (expired session), then retry.","Retry the sync after confirming the server version matches the CLI (upgrade server or CLI if endpoints are missing)."],"exampleFix":"// before\nplandex models  # 'error getting server models input: unauthorized'\n// after\nplandex auth   # refresh expired session\nplandex models","handlingStrategy":"retry","validationCode":"// Light pre-check: server reachability and auth before sync\nif auth.Current == nil || auth.Current.UserId == \"\" {\n    return fmt.Errorf(\"not logged in\")\n}\n// optionally ping the server host before calling SyncCustomModels","typeGuard":"func isServerError(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"error getting server models input\")\n}","tryCatchPattern":"if err := lib.SyncCustomModels(); err != nil {\n    if isServerError(err) {\n        term.Error(\"Could not reach server or API rejected the request; check \" +\n            \"connectivity/auth: \" + err.Error())\n        return\n    }\n    return err\n}","preventionTips":["Verify server URL and connectivity before running sync operations.","Refresh auth when errors mention unauthorized/forbidden.","Keep server and CLI versions compatible so all three list endpoints exist.","Add bounded retry with backoff for transient network failures in automation."],"tags":["go","api","network","custom-models","sync"],"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"}