github/github-mcp-server · error

updated_field requires either id or name

Error message

updated_field requires either id or name

What it means

Raised by parseBatchFieldSpec (pkg/github/projects_batch.go:520) when the updated_field object contains neither 'id' nor 'name', leaving the library with no way to identify which project field to update. It fails the entire request up front, before items are parsed or any network call is made.

Source

Thrown at pkg/github/projects_batch.go:520

	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
}

func resolveBatchProjectField(ctx context.Context, gqlClient *githubv4.Client, owner, ownerType string, projectNumber int, spec batchFieldSpec) (*ResolvedField, error) {
	if spec.name != "" {

View on GitHub (pinned to 0ea1f775a7)

Solutions

  1. Add exactly one identifier: "name": "Status" (resolved by name) or "id": 123456 (numeric field database ID)
  2. If unsure of exact field names, call the list-project-fields tool first and copy the name or id from it
  3. Note id must be the field's database ID, not the project ID
  4. Validate the object has (id XOR name) plus value before sending

Example fix

// before
{"updated_field": {"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 requires id or name")
}

Type guard

func hasExactlyOneFieldID(spec map[string]any) bool {
	_, id := spec["id"]
	_, name := spec["name"]
	return id != name
}

Prevention

When it happens

Trigger: {"updated_field": {"value": "Done"}} — only the value is supplied. Also field names spelled differently ("field", "field_name", "key") leave both identifier keys absent.

Common situations: Schema confusion where the caller assumes the field is positional or inferred from the value; renaming between tool versions; hand-built JSON that forgot the identifier property.

Related errors


AI-assisted analysis of github/github-mcp-server@0ea1f775a7 (2026-08-15). Data as JSON: /api/errors/e6e5e1b615505a2c. Report an issue: GitHub.