github/github-mcp-server · error
updated_field must set either id or name, not both
Error message
updated_field must set either id or name, not both
What it means
Raised by parseBatchFieldSpec (pkg/github/projects_batch.go:518) when the updated_field object sets both 'id' and 'name'. The library refuses ambiguity about which field identifier wins and fails the whole request before any item is processed — this is a top-level argument error, not a per-item one.
Source
Thrown at pkg/github/projects_batch.go:518
func parseBatchFieldSpec(raw any) (batchFieldSpec, error) {
var spec batchFieldSpec
input, ok := raw.(map[string]any)
if !ok || input == nil {
return spec, fmt.Errorf("updated_field must be an object")
}
value, hasValue := input["value"]
if !hasValue {
return spec, fmt.Errorf("updated_field.value is required")
}
spec.value = value
idField, hasID := input["id"]
nameField, hasName := input["name"]
switch {
case hasID && hasName:
return spec, fmt.Errorf("updated_field must set either id or name, not both")
case !hasID && !hasName:
return spec, fmt.Errorf("updated_field requires either id or name")
case hasID:
id, err := validatePositiveInt64(idField)
if err != nil {
return spec, fmt.Errorf("updated_field.id: %w", err)
}
spec.id = id
default:
name, ok := nameField.(string)
if !ok || name == "" {
return spec, fmt.Errorf("updated_field.name must be a non-empty string")
}
spec.name = name
}
return spec, nil
}
View on GitHub (pinned to 0ea1f775a7)
Solutions
- Delete one of the two keys — keep name for readability or id to skip the field-by-name resolution
- If your source has both, pick id when it came from a recent list_project_fields call
- Strip null-valued keys before sending; null counts as present for this check
- Remember the choice applies to the entire batch, not one item
Example fix
// before
{"updated_field": {"id": 123456, "name": "Status", "value": "Done"}}
// after
{"updated_field": {"name": "Status", "value": "Done"}} Defensive patterns
Strategy: validation
Validate before calling
_, hasID := spec["id"]
_, hasName := spec["name"]
if hasID && hasName {
return fmt.Errorf("updated_field: set only one of id or name")
} Type guard
func hasExactlyOneFieldID(spec map[string]any) bool {
_, id := spec["id"]
_, name := spec["name"]
return id != name // exactly one true
} Prevention
- Strip null-valued keys before sending — null counts as present for this check
- Choose name for readability, id only when freshly fetched from list_project_fields
- Keep one source of truth for the field identifier in your config
When it happens
Trigger: {"updated_field": {"id": 123456, "name": "Status", "value": "Done"}} — both identifier keys present. Both keys are looked up with Go's two-value map access, so "id": null plus "name": "Status" still counts as both set.
Common situations: Merging a cached field record (has id) with a human-readable override (has name); serializers that emit null for unset keys, which still counts as present here; defensive clients that include every known property.
Related errors
- each item must set exactly one of node_id, item_id, or item_
- updated_field must be an object
- updated_field.value is required
- updated_field requires either id or name
- updated_field.id: %w
AI-assisted analysis of github/github-mcp-server@0ea1f775a7 (2026-08-15).
Data as JSON: /api/errors/52a50ca5fefe36eb.
Report an issue: GitHub.