github/github-mcp-server · error
value cannot be null for field %q
Error message
value cannot be null for field %q
What it means
optionalIssueWriteFields (pkg/github/issues.go:271) rejects any issue_fields item whose value key is present but explicitly null. JSON null unmarshals to a nil any, which the validation treats as an invalid attempt to null a field — the API has no null value, only deletion. Use "delete": true or omit the key.
Source
Thrown at pkg/github/issues.go:271
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{
FieldName: fieldName,
Delete: true,
})
continue
}
if hasValue && fieldOptionName != "" {
return nil, fmt.Errorf("issue field %q cannot specify both value and field_option_name", fieldName)
}
if !hasValue && fieldOptionName == "" {View on GitHub (pinned to 0ea1f775a7)
Solutions
- To clear a field use {"field_name":"Due Date","delete":true}
- To leave a field alone, omit the value key entirely
- Mark optional pointer fields with omitempty when marshaling Go structs to tool args
Example fix
# before
{"issue_fields": [{"field_name": "Due Date", "value": null}]}
# after
{"issue_fields": [{"field_name": "Due Date", "delete": true}]} Defensive patterns
Strategy: validation
Validate before calling
for _, item := range inputMaps {
if v, present := item["value"]; present && v == nil {
return errors.New("value cannot be null; use delete:true or omit the key")
}
} Type guard
func hasNullValue(item map[string]any) bool {
v, present := item["value"]
return present && v == nil
} Prevention
- Use omitempty on optional pointer fields when marshaling Go structs into tool args
- Translate 'clear this field' intent to delete:true at the call site, never to null
- Lint generated JSON tool args for explicit nulls before sending
When it happens
Trigger: update_issue with {"field_name":"Due Date","value":null}; common when callers try to clear a field by nulling it, or when JSON builders emit null for absent optional members.
Common situations: LLM tool args synthesizing null for optional fields; client code marshaling nil pointers as null instead of omitempty; users assuming null clears a field.
Related errors
- each issue_fields item must be an object
- issue_fields must be an array
- field_name is required for each issue_fields item
- 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/6cf63f4208ae2bdc.
Report an issue: GitHub.