github/github-mcp-server · error

issue field %q cannot specify both value and field_option_na

Error message

issue field %q cannot specify both value and field_option_name

What it means

optionalIssueWriteFields (pkg/github/issues.go:286) enforces that a non-delete issue_fields item sets a field by exactly one mechanism: a literal value OR a field_option_name for single-select fields. The error fires when both are present on the same item; the two are ambiguous (is "P0" a string value or an option name?).

Source

Thrown at pkg/github/issues.go:286

		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 == "" {
			return nil, fmt.Errorf("issue field %q must specify either value or field_option_name", fieldName)
		}

		issueFields = append(issueFields, issueWriteFieldInput{
			FieldName:       fieldName,
			Value:           value,
			FieldOptionName: fieldOptionName,
		})
	}

	return issueFields, nil
}

func resolveIssueRequestFieldValues(ctx context.Context, gqlClient *githubv4.Client, owner, repo string, issueFields []issueWriteFieldInput) ([]*github.IssueRequestFieldValue, []int64, error) {
	if len(issueFields) == 0 {

View on GitHub (pinned to 0ea1f775a7)

Solutions

  1. For single-select fields keep only field_option_name: {"field_name":"Priority","field_option_name":"P0"}
  2. For text/number/date fields keep only value
  3. Drop the other key entirely — do not send it empty

Example fix

# before
{"issue_fields": [{"field_name": "Priority", "value": "P0", "field_option_name": "P0"}]}

# after
{"issue_fields": [{"field_name": "Priority", "field_option_name": "P0"}]}
Defensive patterns

Strategy: validation

Validate before calling

for _, item := range inputMaps {
    _, hasValue := item["value"]
    opt, _ := item["field_option_name"].(string)
    if hasValue && strings.TrimSpace(opt) != "" {
        return errors.New("specify either value or field_option_name, not both")
    }
}

Type guard

func isSinglePayload(item map[string]any) bool {
    _, hasValue := item["value"]
    opt, _ := item["field_option_name"].(string)
    return !(hasValue && strings.TrimSpace(opt) != "")
}

Prevention

When it happens

Trigger: update_issue with {"field_name":"Priority","value":"P0","field_option_name":"P0"} on a single-select field; also mixing value with an option name for text fields.

Common situations: LLM-generated args filling every optional property; schema confusion where callers add both 'just to be safe'; templates merged from two examples.

Related errors


AI-assisted analysis of github/github-mcp-server@0ea1f775a7 (2026-08-15). Data as JSON: /api/errors/bba303178f4b2ad9. Report an issue: GitHub.