github/github-mcp-server · error

issue field %q must specify either value or field_option_nam

Error message

issue field %q must specify either value or field_option_name

What it means

optionalIssueWriteFields (pkg/github/issues.go:290) is the final shape check on a non-delete issue_fields item: it must carry either value or field_option_name. The error fires when an item has field_name but no payload at all — an update that would be a no-op is rejected before any network call.

Source

Thrown at pkg/github/issues.go:290

		}

		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 {
		return nil, nil, nil
	}

	ctxWithFeatures := ghcontext.WithGraphQLFeatures(ctx, "issue_fields", "repo_issue_fields")

View on GitHub (pinned to 0ea1f775a7)

Solutions

  1. Add the payload: value for text/number/date fields, field_option_name for single-select
  2. If the goal is to clear the field use delete:true
  3. If the goal is to read field values, use the read tooling instead of update_issue

Example fix

# before
{"issue_fields": [{"field_name": "Priority"}]}

# after
{"issue_fields": [{"field_name": "Priority", "field_option_name": "P1"}]}
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("each non-delete issue_fields item needs value or field_option_name")
    }
}

Type guard

func hasPayload(item map[string]any) bool {
    if del, _ := item["delete"].(bool); del {
        return true
    }
    _, 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"} alone; or {"field_name":"Priority","value":""} is NOT this case (empty string counts as a value) — the pure absence of both keys triggers it.

Common situations: Agents enumerating field names without payloads; partially-built args from templating; callers expecting field_name alone to read a field (use get_issue / get_labels style reads instead).

Related errors


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