googleapis/mcp-toolbox · error

parameter name must be unique across all parameter fields. D

Error message

parameter name must be unique across all parameter fields. Duplicate parameter: %s

What it means

CheckDuplicateParameters enforces that every parameter across all parameter fields (parameters, authRequired params, etc.) has a unique name. If two Parameter objects share a name, initialization fails with this error naming the duplicate.

Source

Thrown at internal/util/parameters/common.go:118

	parsedTmpl, err := tmpl.Parse(templateString)
	if err != nil {
		return "", fmt.Errorf("error parsing template '%s': %w", templateName, err)
	}

	var result bytes.Buffer
	if err := parsedTmpl.Execute(&result, data); err != nil {
		return "", fmt.Errorf("error executing template '%s': %w", templateName, err)
	}
	return result.String(), nil
}

// CheckDuplicateParameters verify there are no duplicate parameter names
func CheckDuplicateParameters(ps Parameters) error {
	seenNames := make(map[string]bool)
	for _, p := range ps {
		pName := p.GetName()
		if _, exists := seenNames[pName]; exists {
			return fmt.Errorf("parameter name must be unique across all parameter fields. Duplicate parameter: %s", pName)
		}
		seenNames[pName] = true
	}
	return nil
}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Rename one of the duplicate parameters in the tool config
  2. Check the tools.yaml for two parameters with the same name across all fields
  3. If one param should serve both purposes, delete the redundant declaration
  4. Review recently merged config changes for accidental duplication

Example fix

// before
parameters:
  - name: id
  - name: id
// after
parameters:
  - name: id
  - name: limit
Defensive patterns

Strategy: validation

Validate before calling

func validateUniqueNames(ps Parameters) error {
    seen := map[string]bool{}
    for _, p := range ps {
        n := p.GetName()
        if seen[n] {
            return fmt.Errorf("duplicate parameter: %s", n)
        }
        seen[n] = true
    }
    return nil
}

Type guard

null

Try / catch

if err := CheckDuplicateParameters(ps); err != nil {
    return nil, fmt.Errorf("tool config invalid: %w", err)
}

Prevention

When it happens

Trigger: Declaring a tools.yaml/tool config where two parameters (e.g. one in parameters and one in auth parameters, or two entries in the same list) have the same `name`, detected during tool Initialize.

Common situations: Copy-pasting a parameter block and forgetting to rename it; a user param colliding with an auth service field param; merging prebuilt configs with overlapping parameter names.

Related errors


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/ed01f381bd4b9d57. Report an issue: GitHub.