github/github-mcp-server · error
field_name is required for each issue_fields item
Error message
field_name is required for each issue_fields item
What it means
optionalIssueWriteFields (pkg/github/issues.go:260) requires every issue_fields item to carry a non-blank field_name. This error fires when an item omits field_name, or its value is empty/whitespace-only (the code trims before checking). It is a pure input-validation failure; no API call is made.
Source
Thrown at pkg/github/issues.go:260
case []any:
for _, item := range v {
itemMap, ok := item.(map[string]any)
if !ok {
return nil, fmt.Errorf("each issue_fields item must be an object")
}
inputMaps = append(inputMaps, itemMap)
}
case []map[string]any:
inputMaps = v
default:
return nil, fmt.Errorf("issue_fields must be an array")
}
issueFields := make([]issueWriteFieldInput, 0, len(inputMaps))
for _, itemMap := range inputMaps {
fieldName, err := RequiredParam[string](itemMap, "field_name")
if err != nil || strings.TrimSpace(fieldName) == "" {
return nil, fmt.Errorf("field_name is required for each issue_fields item")
}
fieldOptionName, err := OptionalParam[string](itemMap, "field_option_name")
if err != nil {
return nil, err
}
deleteField, _ := OptionalParam[bool](itemMap, "delete")
value, hasValue := itemMap["value"]
if hasValue && value == nil {
return nil, fmt.Errorf("value cannot be null for field %q", fieldName)
}
if deleteField {
if hasValue || fieldOptionName != "" {
return nil, fmt.Errorf("issue field %q cannot specify 'delete' together with 'value' or 'field_option_name'", fieldName)
}
issueFields = append(issueFields, issueWriteFieldInput{View on GitHub (pinned to 0ea1f775a7)
Solutions
- Add field_name with the exact name shown in the repository's issue-fields settings: {"field_name":"Priority",...}
- Use snake_case keys exactly as defined by the tool schema
- Trim check: a whitespace-only name is rejected — supply the real name
Example fix
# before
{"issue_fields": [{"value": "P0"}]}
# after
{"issue_fields": [{"field_name": "Priority", "field_option_name": "P0"}]} Defensive patterns
Strategy: validation
Validate before calling
for _, item := range inputMaps {
name, ok := item["field_name"].(string)
if !ok || strings.TrimSpace(name) == "" {
return errors.New("field_name is required for each issue_fields item")
}
} Type guard
func hasFieldName(item map[string]any) bool {
s, ok := item["field_name"].(string)
return ok && strings.TrimSpace(s) != ""
} Prevention
- Use exact snake_case keys from the tool schema (field_name, not fieldName)
- Cross-check field names against the repository's configured issue fields before submitting
- Reject whitespace-only strings in your arg builder, not after a round-trip
When it happens
Trigger: update_issue issue_fields item like {"value":"P0"} (field_name missing) or {"field_name":" ","value":"P0"}. Also fires when RequiredParam[string] itself errors because field_name is a non-string JSON type (number, object).
Common situations: Agents guessing the option-name as field_name; typos like fieldname/fieldName (schema is snake_case); copy-paste payloads missing the key.
Related errors
- each issue_fields item must be an object
- issue_fields must be an array
- value cannot be null for field %q
- issue field %q cannot specify 'delete' together with 'value'
- issue field %q cannot specify both value and field_option_na
AI-assisted analysis of github/github-mcp-server@0ea1f775a7 (2026-08-15).
Data as JSON: /api/errors/e6e974b4b8effdd7.
Report an issue: GitHub.