{"record":{"id":"6cf63f4208ae2bdc","repo":"github/github-mcp-server","slug":"value-cannot-be-null-for-field-q","errorCode":null,"errorMessage":"value cannot be null for field %q","messagePattern":"value cannot be null for field %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/github/issues.go","lineNumber":271,"sourceCode":"\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{\n\t\t\t\tFieldName: fieldName,\n\t\t\t\tDelete:    true,\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\n\t\tif hasValue && fieldOptionName != \"\" {\n\t\t\treturn nil, fmt.Errorf(\"issue field %q cannot specify both value and field_option_name\", fieldName)\n\t\t}\n\n\t\tif !hasValue && fieldOptionName == \"\" {","sourceCodeStart":253,"sourceCodeEnd":289,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/issues.go#L253-L289","documentation":"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.","triggerScenarios":"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.","commonSituations":"LLM tool args synthesizing null for optional fields; client code marshaling nil pointers as null instead of omitempty; users assuming null clears a field.","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"],"exampleFix":"# before\n{\"issue_fields\": [{\"field_name\": \"Due Date\", \"value\": null}]}\n\n# after\n{\"issue_fields\": [{\"field_name\": \"Due Date\", \"delete\": true}]}","handlingStrategy":"validation","validationCode":"for _, item := range inputMaps {\n    if v, present := item[\"value\"]; present && v == nil {\n        return errors.New(\"value cannot be null; use delete:true or omit the key\")\n    }\n}","typeGuard":"func hasNullValue(item map[string]any) bool {\n    v, present := item[\"value\"]\n    return present && v == nil\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["go","validation","issue-fields","json","mcp"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}