{"record":{"id":"b610f56e78e065d0","repo":"github/github-mcp-server","slug":"issue-field-option-q-was-not-found-for-field-q","errorCode":null,"errorMessage":"issue field option %q was not found for field %q","messagePattern":"issue field option %q was not found for field %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/github/issues.go","lineNumber":388,"sourceCode":"\n\t\tresolvedValue := fieldInput.Value\n\t\tif fieldInput.FieldOptionName != \"\" {\n\t\t\tif !strings.EqualFold(dataType, \"single_select\") {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"issue field %q is %q, so field_option_name cannot be used\", fieldInput.FieldName, dataType)\n\t\t\t}\n\n\t\t\toptionFound := false\n\t\t\tfor _, option := range node.IssueFieldSingleSelect.Options {\n\t\t\t\tif strings.EqualFold(strings.TrimSpace(string(option.Name)), strings.TrimSpace(fieldInput.FieldOptionName)) {\n\t\t\t\t\t// REST API expects the option name, not the ID\n\t\t\t\t\tresolvedValue = string(option.Name)\n\t\t\t\t\toptionFound = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !optionFound {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"issue field option %q was not found for field %q\", fieldInput.FieldOptionName, fieldInput.FieldName)\n\t\t\t}\n\t\t}\n\n\t\tresolved = append(resolved, &github.IssueRequestFieldValue{\n\t\t\tFieldID: fieldID,\n\t\t\tValue:   resolvedValue,\n\t\t})\n\t}\n\n\treturn resolved, fieldIDsToDelete, nil\n}\n\n// fetchExistingIssueFieldValues retrieves the current field values for an issue\n// as IssueRequestFieldValue entries, ready to be merged before an update.\nfunc fetchExistingIssueFieldValues(ctx context.Context, gqlClient *githubv4.Client, owner, repo string, issueNumber int) ([]*github.IssueRequestFieldValue, error) {\n\tctxWithFeatures := ghcontext.WithGraphQLFeatures(ctx, \"issue_fields\", \"repo_issue_fields\")\n\n\tvar query struct {","sourceCodeStart":370,"sourceCodeEnd":406,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/issues.go#L370-L406","documentation":"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.","triggerScenarios":"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.","commonSituations":"Admins pruning/renaming options after automations were written; typo'd option names; assuming global option names shared across fields.","solutions":["List the field's options in repo settings and use the exact option name (case-insensitive)","If the option was renamed, update the payload to the new name","If the option should exist, add it to the field in repository settings first"],"exampleFix":"# before (field offers P1/P2/P3)\n{\"issue_fields\": [{\"field_name\": \"Priority\", \"field_option_name\": \"P0\"}]}\n\n# after\n{\"issue_fields\": [{\"field_name\": \"Priority\", \"field_option_name\": \"P1\"}]}","handlingStrategy":"validation","validationCode":"meta := fetchRepoIssueFieldMetadata(ctx, gqlClient, owner, repo) // name -> {dataType, options}\nfor _, f := range fields {\n    if f.FieldOptionName == \"\" {\n        continue\n    }\n    m := meta[strings.ToLower(strings.TrimSpace(f.FieldName))]\n    found := false\n    for _, opt := range m.Options {\n        if strings.EqualFold(strings.TrimSpace(opt), strings.TrimSpace(f.FieldOptionName)) {\n            found = true\n            break\n        }\n    }\n    if !found {\n        return fmt.Errorf(\"option %q not in field %q (options: %v)\", f.FieldOptionName, f.FieldName, m.Options)\n    }\n}","typeGuard":"func isKnownOption(option string, options []string) bool {\n    for _, o := range options {\n        if strings.EqualFold(strings.TrimSpace(o), strings.TrimSpace(option)) {\n            return true\n        }\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Cache each single-select field's option list and validate payloads against it","Subscribe to repo config changes — renamed options are the top cause in the wild","Option matching is case-insensitive and trimmed; fix typos locally before the API call"],"tags":["go","graphql","issue-fields","validation"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}