{"record":{"id":"444017f7667eb315","repo":"plandex-ai/plandex","slug":"error-fetching-custom-models-v","errorCode":null,"errorMessage":"error fetching custom models: %v","messagePattern":"error fetching custom models: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/lib/custom_models.go","lineNumber":80,"sourceCode":"\t\tmodelPacks, apiErr := api.Client.ListModelPacks()\n\t\tif apiErr != nil {\n\t\t\terrCh <- apiErr\n\t\t\treturn\n\t\t}\n\n\t\tschemas := make([]*shared.ModelPackSchema, len(modelPacks))\n\t\tfor i, modelPack := range modelPacks {\n\t\t\tschemas[i] = modelPack.ToModelPackSchema()\n\t\t}\n\n\t\tcustomModelPacks = schemas\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\treturn nil, fmt.Errorf(\"error fetching custom models: %v\", err.Msg)\n\t\t}\n\t}\n\n\tserverModelsInput := &shared.ModelsInput{\n\t\tCustomModels:     customModels,\n\t\tCustomProviders:  customProviders,\n\t\tCustomModelPacks: customModelPacks,\n\t}\n\n\treturn serverModelsInput, nil\n}\n\nfunc CustomModelsCheckLocalChanges(path string) (CustomModelsCheckLocalChangesResult, error) {\n\thashPath := path + \".hash\"\n\n\texists, err := fs.FileExists(path)\n\tif err != nil {\n\t\treturn CustomModelsCheckLocalChangesResult{}, err","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/lib/custom_models.go#L62-L98","documentation":"GetServerModelsInput fetches custom models/providers via three goroutines communicating over an errCh; if any of the three results carries a non-nil error it aborts with 'error fetching custom models: %v'. It aggregates a failure in retrieving server-side custom model configuration.","triggerScenarios":"Any of the 3 parallel fetches (custom models, custom providers, or the third fetch) pushes an error onto errCh — e.g. server API call fails, auth error, or response parse failure while syncing custom models.","commonSituations":"API/server outage or network error while loading custom models; invalid API key; custom provider config on the server is malformed and fails to deserialize; timeout on the models endpoint.","solutions":["Read the wrapped inner error (err.Msg) for the failing fetch's root cause","Retry — transient server/network errors often clear on re-run (SyncCustomModels retries the flow)","Verify authentication and that the models endpoint is reachable","Review server-side custom models/providers for malformed entries and remove/fix them"],"exampleFix":"// before: first error aborts everything\nfor i := 0; i < 3; i++ {\n    err := <-errCh\n    if err != nil {\n        return nil, fmt.Errorf(\"error fetching custom models: %v\", err.Msg)\n    }\n}\n// after: caller retries on failure\ninput, err := GetServerModelsInput(...)\nif err != nil {\n    return retry(3, func() error { _, err = GetServerModelsInput(...); return err })\n}","handlingStrategy":"retry","validationCode":"if err := pingModelsEndpoint(ctx); err != nil {\n    return fmt.Errorf(\"models endpoint unreachable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"input, err := GetServerModelsInput(...)\nif err != nil && strings.Contains(err.Error(), \"error fetching custom models\") {\n    // bounded retry for transient server/network failures\n    for i := 0; i < 3; i++ {\n        if input, err = GetServerModelsInput(...); err == nil {\n            break\n        }\n        time.Sleep(backoff(i))\n    }\n}","preventionTips":["Verify API key/auth before syncing custom models","Apply exponential backoff retries around model fetching","Validate custom provider configs server-side to avoid deserialization failures"],"tags":["network","api","models","concurrency"],"backgroundTag":"custom-models-fetch-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"}