github/github-mcp-server · error

field_filters: %q is not a valid option for %q. Valid option

Error message

field_filters: %q is not a valid option for %q. Valid options: %s

What it means

For a SINGLE_SELECT issue field, resolveFieldFilters validates the supplied value against the field's configured options (case-insensitive match) before sending the GraphQL query, and reports all valid option names on mismatch. This avoids an opaque GraphQL error from GitHub.

Source

Thrown at pkg/github/issues.go:3131

		filter := IssueFieldValueFilter{FieldName: githubv4.String(field.Name)}
		switch field.DataType {
		case "SINGLE_SELECT":
			// Validate the option name against the field's options so we fail fast
			// with a useful error instead of an opaque GraphQL one.
			var matched string
			for _, o := range field.Options {
				if strings.EqualFold(o.Name, rf.Value) {
					matched = o.Name
					break
				}
			}
			if matched == "" {
				optionNames := make([]string, 0, len(field.Options))
				for _, o := range field.Options {
					optionNames = append(optionNames, o.Name)
				}
				return nil, fmt.Errorf("field_filters: %q is not a valid option for %q. Valid options: %s", rf.Value, field.Name, strings.Join(optionNames, ", "))
			}
			v := githubv4.String(matched)
			filter.SingleSelectOptionValue = &v
		case "TEXT":
			v := githubv4.String(rf.Value)
			filter.TextValue = &v
		case "DATE":
			if _, err := time.Parse("2006-01-02", rf.Value); err != nil {
				return nil, fmt.Errorf("field_filters: %q is not a valid date for %q (expected YYYY-MM-DD): %s", rf.Value, field.Name, err.Error())
			}
			v := githubv4.String(rf.Value)
			filter.DateValue = &v
		case "NUMBER":
			n, err := strconv.ParseFloat(rf.Value, 64)
			if err != nil {
				return nil, fmt.Errorf("field_filters: %q is not a valid number for %q: %s", rf.Value, field.Name, err.Error())
			}
			v := githubv4.Float(n)

View on GitHub (pinned to 0ea1f775a7)

Solutions

  1. Use one of the option names listed in the error's 'Valid options' section exactly (case-insensitive)
  2. Re-fetch the field definitions to see current options if they were changed recently
  3. Ask the repo admin to add the option if it genuinely should exist

Example fix

// before
{"field_filters":[{"field_name":"Status","value":"wontfix"}]}
// after
{"field_filters":[{"field_name":"Status","value":"Won't Fix"}]}
Defensive patterns

Strategy: validation

Validate before calling

func validateSingleSelectOption(value string, options []string) error {
	for _, o := range options {
		if strings.EqualFold(o, value) {
			return nil
		}
	}
	return fmt.Errorf("%q is not a valid option; valid: %s", value, strings.Join(options, ", "))
}

Type guard

func isValidOption(value string, options []string) bool {
	for _, o := range options {
		if strings.EqualFold(o, value) {
			return true
		}
	}
	return false
}

Try / catch

if err != nil && strings.Contains(err.Error(), "is not a valid option for") {
    // Message includes 'Valid options:'; choose one of those and retry.
}

Prevention

When it happens

Trigger: field_filters entry with a SINGLE_SELECT field (e.g. Status) and a value that is not one of its options, e.g. {"field_name":"Status","value":"Won't Fix"} when the options are Bug, In Progress, Done.

Common situations: Options renamed or removed by project admins; an LLM guessing an option name; locale/casing variants like "done" are fine (case-insensitive) but abbreviations like "wontfix" are not.

Related errors


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