plandex-ai/plandex · error

Model pack name is required

Error message

Model pack name is required

What it means

Every custom model pack in the ModelsInput must have a non-empty Name, which identifies the pack in role configuration. If any entry in CustomModelPacks has an empty Name, the handler rejects the request with HTTP 400 and this message.

Source

Thrown at app/server/handlers/models.go:96

			msg := "Model id is required"
			log.Println(msg)
			http.Error(w, msg, http.StatusBadRequest)
			return
		}

		if shared.BuiltInBaseModelsById[model.ModelId] != nil {
			msg := fmt.Sprintf("%s is a built-in base model id, so it can't be used for a custom model", model.ModelId)
			log.Println(msg)
			http.Error(w, msg, http.StatusUnprocessableEntity)
			return
		}
	}

	for _, modelPack := range modelsInput.CustomModelPacks {
		if modelPack.Name == "" {
			msg := "Model pack name is required"
			log.Println(msg)
			http.Error(w, msg, http.StatusBadRequest)
			return
		}

		if shared.BuiltInModelPacksByName[modelPack.Name] != nil {
			msg := fmt.Sprintf("%s is a built-in model pack name, so it can't be used for a custom model pack", modelPack.Name)
			log.Println(msg)
			http.Error(w, msg, http.StatusUnprocessableEntity)
			return
		}
	}

	var existingCustomModelIds = make(map[shared.ModelId]bool)
	var existingCustomProviderNames = make(map[string]bool)

	customModels, err := db.ListCustomModels(auth.OrgId)
	if err != nil {
		log.Printf("Error fetching custom models: %v\n", err)
		http.Error(w, "Failed to create custom model: "+err.Error(), http.StatusInternalServerError)

View on GitHub (pinned to e2d772072e)

Solutions

  1. Set a unique, non-empty name on every object in the customModelPacks array
  2. Validate pack names client-side before sending the request
  3. Inspect the outgoing JSON for packs with name: "" or a missing name key
  4. Choose names distinct from built-in model pack names (that raises a separate 422 error)

Example fix

// before
{"customModelPacks": [{"models": {"plan": "my-model"}}]}
// after
{"customModelPacks": [{"name": "my-pack", "models": {"plan": "my-model"}}]}
Defensive patterns

Strategy: validation

Validate before calling

for i, p := range input.CustomModelPacks {
    if p.Name == "" {
        return fmt.Errorf("customModelPacks[%d].name is required", i)
    }
}

Type guard

func packNamed(p *shared.ModelPackSchema) bool { return p != nil && p.Name != "" }

Prevention

When it happens

Trigger: POSTing to the custom models upsert endpoint with a CustomModelPacks element whose name field is missing or empty.

Common situations: Hand-writing a model pack in models.json and omitting the name key; scripted pack generation where a name variable was empty; stripping the name during a JSON transformation.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05). Data as JSON: /api/errors/27bd4d6bce101b9f. Report an issue: GitHub.