{"record":{"id":"1290ebf960e97ceb","repo":"plandex-ai/plandex","slug":"failed-to-fetch-model-packs","errorCode":null,"errorMessage":"Failed to fetch model packs: ","messagePattern":"Failed to fetch model packs: ","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"app/server/handlers/models.go","lineNumber":508,"sourceCode":"\thttp.Error(w, \"Use POST /custom_models instead to update model packs\", http.StatusBadRequest)\n}\n\nfunc ListModelPacksHandler(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"Received request for ListModelPacksHandler\")\n\n\tauth := Authenticate(w, r, true)\n\tif auth == nil {\n\t\treturn\n\t}\n\n\tif !requireMinClientVersion(w, r, CustomModelsMinClientVersion) {\n\t\treturn\n\t}\n\n\tsets, err := db.ListModelPacks(auth.OrgId)\n\tif err != nil {\n\t\tlog.Printf(\"Error fetching model packs: %v\\n\", err)\n\t\thttp.Error(w, \"Failed to fetch model packs: \"+err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tvar apiPacks []*shared.ModelPack\n\n\tfor _, mp := range sets {\n\t\tapiPacks = append(apiPacks, mp.ToApi())\n\t}\n\n\tjson.NewEncoder(w).Encode(apiPacks)\n\n\tlog.Println(\"Successfully fetched model packs\")\n}\n","sourceCodeStart":490,"sourceCodeEnd":522,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/handlers/models.go#L490-L522","documentation":"HTTP 500 error body sent by ListModelPacksHandler when db.ListModelPacks fails to load the model packs for the authenticated user's org from the database. It indicates a server-side storage/query failure (not a client problem) — the handler has already passed authentication and minimum client version checks, and the raw database error string is appended to the response.","triggerScenarios":"Thrown at app/server/handlers/models.go:508 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check server logs for the wrapped db error","Verify DB connectivity and the model_packs schema","Retry the request once the DB issue is resolved"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}