{"record":{"id":"e6e974b4b8effdd7","repo":"github/github-mcp-server","slug":"field-name-is-required-for-each-issue-fields-item","errorCode":null,"errorMessage":"field_name is required for each issue_fields item","messagePattern":"field_name is required for each issue_fields item","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/github/issues.go","lineNumber":260,"sourceCode":"\tcase []any:\n\t\tfor _, item := range v {\n\t\t\titemMap, ok := item.(map[string]any)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"each issue_fields item must be an object\")\n\t\t\t}\n\t\t\tinputMaps = append(inputMaps, itemMap)\n\t\t}\n\tcase []map[string]any:\n\t\tinputMaps = v\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"issue_fields must be an array\")\n\t}\n\n\tissueFields := make([]issueWriteFieldInput, 0, len(inputMaps))\n\tfor _, itemMap := range inputMaps {\n\t\tfieldName, err := RequiredParam[string](itemMap, \"field_name\")\n\t\tif err != nil || strings.TrimSpace(fieldName) == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"field_name is required for each issue_fields item\")\n\t\t}\n\n\t\tfieldOptionName, err := OptionalParam[string](itemMap, \"field_option_name\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tdeleteField, _ := OptionalParam[bool](itemMap, \"delete\")\n\t\tvalue, hasValue := itemMap[\"value\"]\n\t\tif hasValue && value == nil {\n\t\t\treturn nil, fmt.Errorf(\"value cannot be null for field %q\", fieldName)\n\t\t}\n\n\t\tif deleteField {\n\t\t\tif hasValue || fieldOptionName != \"\" {\n\t\t\t\treturn nil, fmt.Errorf(\"issue field %q cannot specify 'delete' together with 'value' or 'field_option_name'\", fieldName)\n\t\t\t}\n\t\t\tissueFields = append(issueFields, issueWriteFieldInput{","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/issues.go#L242-L278","documentation":"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.","triggerScenarios":"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).","commonSituations":"Agents guessing the option-name as field_name; typos like fieldname/fieldName (schema is snake_case); copy-paste payloads missing the key.","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"],"exampleFix":"# before\n{\"issue_fields\": [{\"value\": \"P0\"}]}\n\n# after\n{\"issue_fields\": [{\"field_name\": \"Priority\", \"field_option_name\": \"P0\"}]}","handlingStrategy":"validation","validationCode":"for _, item := range inputMaps {\n    name, ok := item[\"field_name\"].(string)\n    if !ok || strings.TrimSpace(name) == \"\" {\n        return errors.New(\"field_name is required for each issue_fields item\")\n    }\n}","typeGuard":"func hasFieldName(item map[string]any) bool {\n    s, ok := item[\"field_name\"].(string)\n    return ok && strings.TrimSpace(s) != \"\"\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["go","validation","issue-fields","mcp"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}