{"record":{"id":"53e90cb9a8776a87","repo":"plandex-ai/plandex","slug":"use-post-custom-models-instead-to-create-model-pa","errorCode":null,"errorMessage":"Use POST /custom_models instead to create model packs","messagePattern":"Use POST /custom_models instead to create model packs","errorType":"http","errorClass":null,"httpStatus":400,"severity":"warning","filePath":"app/server/handlers/models.go","lineNumber":475,"sourceCode":"\t\treturn\n\t}\n\n\tlog.Println(\"Successfully fetched custom providers\")\n}\n\nfunc CreateModelPackHandler(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"Received request for CreateModelPackHandler\")\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\thttp.Error(w, \"Use POST /custom_models instead to create model packs\", http.StatusBadRequest)\n}\n\nfunc UpdateModelPackHandler(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"Received request for UpdateModelPackHandler\")\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\thttp.Error(w, \"Use POST /custom_models instead to update model packs\", http.StatusBadRequest)\n}\n\nfunc ListModelPacksHandler(w http.ResponseWriter, r *http.Request) {","sourceCodeStart":457,"sourceCodeEnd":493,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/handlers/models.go#L457-L493","documentation":"CreateModelPackHandler is a deprecated stub. Once custom models (POST /custom_models) shipped, the old model-pack creation endpoint was removed and now unconditionally returns HTTP 400 telling callers to use POST /custom_models instead. No logic runs besides auth and a minimum client-version check.","triggerScenarios":"Any POST to the legacy model-pack creation endpoint with a client at least CustomModelsMinClientVersion; older clients are rejected earlier by requireMinClientVersion.","commonSituations":"Automated scripts or SDK versions still calling the pre-custom-models API surface; cached API docs referencing model packs; integrations not updated after a Plandex server upgrade.","solutions":["Switch the call to POST /custom_models.","Upgrade the Plandex client/CLI to a version that uses the custom models API.","Update internal scripts/docs that still reference the legacy model-pack endpoints."],"exampleFix":"// before\nPOST /server/model_packs {\"pack\": {...}}\n// after\nPOST /server/custom_models {\"pack\": {...}}","handlingStrategy":"validation","validationCode":"// client-side: use the replacement endpoint directly\nconst modelPackEndpoint = \"/custom_models\" // legacy /model_packs create returns 400","typeGuard":"func isLegacyModelPackRoute(path string) bool {\n\treturn strings.HasPrefix(path, \"/model_packs\")\n}","tryCatchPattern":"resp, err := client.Post(base+\"/custom_models\", \"application/json\", body)\nif err != nil { return err }\nif resp.StatusCode == 400 && strings.Contains(readBody(resp), \"Use POST /custom_models\") {\n\treturn migrateToCustomModelsCall()\n}","preventionTips":["Pin clients to server versions where the custom models API exists.","Replace all /model_packs references in scripts and docs.","Handle 400 responses containing migration hints by switching endpoints automatically."],"tags":["http-400","deprecated-endpoint","migration","api-change"],"backgroundTag":"deprecated-endpoint","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"}