plandex-ai/plandex · error

Has duplicates:

Error message

Has duplicates: 

What it means

The handler runs ModelsInput.CheckNoDuplicates() to ensure no duplicate model ids, provider names, or model pack names appear in the payload. If duplicates are found, CheckNoDuplicates returns false plus a descriptive message, and the server responds HTTP 400 with "Has duplicates: " + that message. Note the inverted-looking condition: !hasDuplicates means the check failed.

Source

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

	if len(modelsInput.CustomModels) > 0 {
		if os.Getenv("IS_CLOUD") != "" {
			apiOrg, err := getApiOrg(auth.OrgId)
			if err != nil {
				log.Printf("Error fetching org: %v\n", err)
				http.Error(w, "Failed to create custom model: "+err.Error(), http.StatusInternalServerError)
				return
			}

			if apiOrg.IntegratedModelsMode {
				http.Error(w, "Custom models are not supported on Plandex Cloud in Integrated Models mode", http.StatusBadRequest)
				return
			}
		}
	}

	hasDuplicates, errMsg := modelsInput.CheckNoDuplicates()
	if !hasDuplicates {
		http.Error(w, "Has duplicates: "+errMsg, http.StatusBadRequest)
		return
	}

	for _, provider := range modelsInput.CustomProviders {
		if provider.Name == "" {
			msg := "Provider name is required"
			log.Println(msg)
			http.Error(w, msg, http.StatusBadRequest)
			return
		}
	}

	for _, model := range modelsInput.CustomModels {
		if model.ModelId == "" {
			msg := "Model id is required"
			log.Println(msg)
			http.Error(w, msg, http.StatusBadRequest)
			return

View on GitHub (pinned to e2d772072e)

Solutions

  1. Read the text after "Has duplicates: " to see exactly which name/id is duplicated
  2. Deduplicate entries by id/name in your config before applying
  3. Call CheckNoDuplicates() on the ModelsInput client-side to catch this before the request
  4. If merging configs, key entries by id/name and overwrite instead of appending

Example fix

// before
customModels: [
  {modelId: "my-gpt", ...},
  {modelId: "my-gpt", ...}
]
// after
customModels: [
  {modelId: "my-gpt", ...}
]
Defensive patterns

Strategy: validation

Validate before calling

ok, errMsg := input.CheckNoDuplicates()
if !ok {
    return fmt.Errorf("duplicate in models input: %s", errMsg)
}

Prevention

When it happens

Trigger: POSTing a ModelsInput where the same custom model id, provider name, or model pack name appears more than once across CustomProviders, CustomModels, or CustomModelPacks arrays.

Common situations: Merging two exported models.json files without deduplicating; scripted configs that append rather than replace entries; copy-pasting a model block to tweak it and forgetting to remove the original.

Related errors


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