github/github-mcp-server · error

issue field option %q was not found for field %q

Error message

issue field option %q was not found for field %q

What it means

resolveIssueRequestFieldValues (pkg/github/issues.go:388) resolves field_option_name against the Options list of the single-select field (case-insensitive, trimmed). The error fires when no configured option matches the supplied name — the option does not exist for that field, so the write aborts before mutation. Note the resolved value sent to REST is the canonical option Name, not an ID.

Source

Thrown at pkg/github/issues.go:388

		resolvedValue := fieldInput.Value
		if fieldInput.FieldOptionName != "" {
			if !strings.EqualFold(dataType, "single_select") {
				return nil, nil, fmt.Errorf("issue field %q is %q, so field_option_name cannot be used", fieldInput.FieldName, dataType)
			}

			optionFound := false
			for _, option := range node.IssueFieldSingleSelect.Options {
				if strings.EqualFold(strings.TrimSpace(string(option.Name)), strings.TrimSpace(fieldInput.FieldOptionName)) {
					// REST API expects the option name, not the ID
					resolvedValue = string(option.Name)
					optionFound = true
					break
				}
			}

			if !optionFound {
				return nil, nil, fmt.Errorf("issue field option %q was not found for field %q", fieldInput.FieldOptionName, fieldInput.FieldName)
			}
		}

		resolved = append(resolved, &github.IssueRequestFieldValue{
			FieldID: fieldID,
			Value:   resolvedValue,
		})
	}

	return resolved, fieldIDsToDelete, nil
}

// fetchExistingIssueFieldValues retrieves the current field values for an issue
// as IssueRequestFieldValue entries, ready to be merged before an update.
func fetchExistingIssueFieldValues(ctx context.Context, gqlClient *githubv4.Client, owner, repo string, issueNumber int) ([]*github.IssueRequestFieldValue, error) {
	ctxWithFeatures := ghcontext.WithGraphQLFeatures(ctx, "issue_fields", "repo_issue_fields")

	var query struct {

View on GitHub (pinned to 0ea1f775a7)

Solutions

  1. List the field's options in repo settings and use the exact option name (case-insensitive)
  2. If the option was renamed, update the payload to the new name
  3. If the option should exist, add it to the field in repository settings first

Example fix

# before (field offers P1/P2/P3)
{"issue_fields": [{"field_name": "Priority", "field_option_name": "P0"}]}

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

Strategy: validation

Validate before calling

meta := fetchRepoIssueFieldMetadata(ctx, gqlClient, owner, repo) // name -> {dataType, options}
for _, f := range fields {
    if f.FieldOptionName == "" {
        continue
    }
    m := meta[strings.ToLower(strings.TrimSpace(f.FieldName))]
    found := false
    for _, opt := range m.Options {
        if strings.EqualFold(strings.TrimSpace(opt), strings.TrimSpace(f.FieldOptionName)) {
            found = true
            break
        }
    }
    if !found {
        return fmt.Errorf("option %q not in field %q (options: %v)", f.FieldOptionName, f.FieldName, m.Options)
    }
}

Type guard

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

Prevention

When it happens

Trigger: update_issue with field_option_name "P0" when the field's options are only ["P1","P2","P3"]; a renamed option ("P0"→"P0-Urgent"); an option defined on a different field.

Common situations: Admins pruning/renaming options after automations were written; typo'd option names; assuming global option names shared across fields.

Related errors


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