{"record":{"id":"e5a5ce321c0a2e0d","repo":"github/github-mcp-server","slug":"failed-to-fetch-existing-issue-field-values-w","errorCode":null,"errorMessage":"failed to fetch existing issue field values: %w","messagePattern":"failed to fetch existing issue field values: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/github/issues.go","lineNumber":423,"sourceCode":"\n\tvar query struct {\n\t\tRepository struct {\n\t\t\tIssue struct {\n\t\t\t\tIssueFieldValues struct {\n\t\t\t\t\tNodes []IssueFieldValueFragment\n\t\t\t\t} `graphql:\"issueFieldValues(first: 25)\"`\n\t\t\t} `graphql:\"issue(number: $number)\"`\n\t\t} `graphql:\"repository(owner: $owner, name: $repo)\"`\n\t}\n\n\tvars := map[string]any{\n\t\t\"owner\":  githubv4.String(owner),\n\t\t\"repo\":   githubv4.String(repo),\n\t\t\"number\": githubv4.Int(issueNumber), // #nosec G115 - issue numbers are always small positive integers\n\t}\n\n\tif err := gqlClient.Query(ctxWithFeatures, &query, vars); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to fetch existing issue field values: %w\", err)\n\t}\n\n\tvar result []*github.IssueRequestFieldValue\n\tfor _, node := range query.Repository.Issue.IssueFieldValues.Nodes {\n\t\tvar fieldIDStr string\n\t\tvar value any\n\n\t\tswitch node.TypeName {\n\t\tcase \"IssueFieldDateValue\":\n\t\t\tfieldIDStr = node.DateValue.Field.FullDatabaseIDStr()\n\t\t\tvalue = string(node.DateValue.Value)\n\t\tcase \"IssueFieldNumberValue\":\n\t\t\tfieldIDStr = node.NumberValue.Field.FullDatabaseIDStr()\n\t\t\tvalue = float64(node.NumberValue.Value)\n\t\tcase \"IssueFieldSingleSelectValue\":\n\t\t\tfieldIDStr = node.SingleSelectValue.Field.FullDatabaseIDStr()\n\t\t\tvalue = string(node.SingleSelectValue.Value)\n\t\tcase \"IssueFieldTextValue\":","sourceCodeStart":405,"sourceCodeEnd":441,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/issues.go#L405-L441","documentation":"The existing-values fetch in pkg/github/issues.go:423 runs a GraphQL query (repository.issue(number:).issueFieldValues(first: 25), under issue-fields feature context) to read an issue's current field values before an update merges changes. This error means that query failed: GraphQL error payload or transport failure — not a validation problem with the new values.","triggerScenarios":"update_issue with issue_fields on an issue that does not exist (issue(number:) fails to resolve), token losing read access mid-session, GraphQL rate limit exhausted, preview unavailable for the token/repo, or network failure to the GraphQL endpoint.","commonSituations":"Issue deleted or made private between tool calls; long-running scripts hitting GraphQL quotas; fine-grained tokens whose repo access was revoked; GHES without the preview.","solutions":["Verify the issue number still exists and is visible: GET /repos/{owner}/{repo}/issues/{number}","Re-check token validity and repo access","Check GraphQL rate limits and back off if exhausted","Retry transient network failures with backoff"],"exampleFix":"// before\n_, err := updateIssueFields(ctx, gqlClient, owner, repo, deletedIssueNumber, fields)\n\n// after\nif _, _, err := client.Issues.Get(ctx, owner, repo, deletedIssueNumber); err != nil {\n    return fmt.Errorf(\"issue not readable: %w\", err)\n}\n_, err := updateIssueFields(ctx, gqlClient, owner, repo, deletedIssueNumber, fields)","handlingStrategy":"try-catch","validationCode":"if _, resp, err := client.Issues.Get(ctx, owner, repo, issueNumber); err != nil {\n    return fmt.Errorf(\"issue #%d not readable in %s/%s: %w\", issueNumber, owner, repo, err)\n} else {\n    _ = resp.Body.Close()\n}","typeGuard":null,"tryCatchPattern":"if err := gqlClient.Query(ctxWithFeatures, &query, vars); err != nil {\n    msg := err.Error()\n    switch {\n    case strings.Contains(msg, \"Could not resolve to\"):\n        return fmt.Errorf(\"issue %s/%s#%d not found\", owner, repo, issueNumber)\n    case strings.Contains(msg, \"rate limit\"):\n        time.Sleep(waitForReset())\n        return retry()\n    }\n    return err\n}","preventionTips":["Re-verify issue existence before field updates in long-running jobs","Batch GraphQL calls within rate budget; issueFieldValues queries cost points per issue","Fail fast on revoked-access signals instead of hammering the endpoint"],"tags":["go","graphql","issue-fields","rate-limit"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}