github/github-mcp-server · error
issue_fields must be an array
Error message
issue_fields must be an array
What it means
optionalIssueWriteFields (pkg/github/issues.go:253) type-switches the issue_fields argument. This error fires when issue_fields is present but is neither []any nor []map[string]any — i.e. the JSON value is a scalar, a single object, or null-shaped non-array. The field must be omitted entirely when unused, or an array of field-update objects.
Source
Thrown at pkg/github/issues.go:253
issueFieldsRaw, exists := args["issue_fields"]
if !exists {
return nil, nil
}
var inputMaps []map[string]any
switch v := issueFieldsRaw.(type) {
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)View on GitHub (pinned to 0ea1f775a7)
Solutions
- Wrap the value in an array: issue_fields=[{"field_name":"Priority",...}]
- Omit issue_fields entirely when not updating fields
- Validate the arg shape client-side against the tool schema before sending
Example fix
# before
{"issue_fields": {"field_name": "Priority", "value": "P0"}}
# after
{"issue_fields": [{"field_name": "Priority", "field_option_name": "P0"}]} Defensive patterns
Strategy: validation
Validate before calling
if raw, ok := args["issue_fields"]; ok {
switch raw.(type) {
case []any, []map[string]any:
// ok
default:
return errors.New("issue_fields must be an array of objects")
}
} Type guard
func isIssueFieldsArray(v any) bool {
switch v.(type) {
case []any, []map[string]any, nil:
return true
}
return false
} Prevention
- Omit issue_fields when not setting fields; an absent key is the clean no-op
- Wrap single-field updates in a one-element array rather than passing a bare object
- Keep an integration test that round-trips every tool payload you generate
When it happens
Trigger: update_issue with issue_fields="Priority" (string), issue_fields={"field_name":"Priority"} (single object), or issue_fields=42. The type switch falls through to default and rejects the shape.
Common situations: Tool callers collapsing the array when updating a single field; LLMs emitting one object instead of a one-element array; config pipelines injecting strings.
Related errors
- each issue_fields item must be an object
- field_name is required for each issue_fields item
- 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/dfbfde46ee558104.
Report an issue: GitHub.