github/github-mcp-server · error
failed to query issue fields metadata: %w
Error message
failed to query issue fields metadata: %w
What it means
resolveIssueRequestFieldValues (pkg/github/issues.go:315) runs a GraphQL metadata query to map issue_fields names to database IDs before an issue write. The query runs under preview feature context ghcontext.WithGraphQLFeatures(ctx, "issue_fields", "repo_issue_fields"). This error means that GraphQL query failed: preview not available to the token/repo, auth failure, rate limit, or a transport error.
Source
Thrown at pkg/github/issues.go:315
})
}
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")
var query issueFieldWriteMetadataQuery
vars := map[string]any{
"owner": githubv4.String(owner),
"repo": githubv4.String(repo),
}
if err := gqlClient.Query(ctxWithFeatures, &query, vars); err != nil {
return nil, nil, fmt.Errorf("failed to query issue fields metadata: %w", err)
}
// Build name → node map, dispatching on concrete type to extract name.
fieldByName := make(map[string]issueFieldWriteMetadataNode, len(query.Repository.IssueFields.Nodes))
for _, node := range query.Repository.IssueFields.Nodes {
var name string
switch string(node.TypeName) {
case "IssueFieldText":
name = string(node.IssueFieldText.Name)
case "IssueFieldNumber":
name = string(node.IssueFieldNumber.Name)
case "IssueFieldDate":
name = string(node.IssueFieldDate.Name)
case "IssueFieldSingleSelect":
name = string(node.IssueFieldSingleSelect.Name)
default:
continue
}View on GitHub (pinned to 0ea1f775a7)
Solutions
- Confirm issue fields are actually configured on the repository (repo Settings → Issues → fields)
- Test the token against the GraphQL endpoint directly with a trivial query to separate auth/preview from network issues
- Wait out the GraphQL rate limit if exhausted (check x-ratelimit-remaining)
- On GHES, verify the version supports issue fields and the GraphQL host is configured
Example fix
# before
update_issue {"issue_fields": [...]} on a repo with no issue fields configured
# after
# configure fields in repo settings first, then:
update_issue {"issue_fields": [{"field_name": "Priority", "field_option_name": "P0"}]} Defensive patterns
Strategy: try-catch
Validate before calling
// smoke-test the token's access to the previewed metadata before batch updates
var probe struct {
Repository struct {
IssueFields struct{ Nodes []struct{ TypeName string `json:"__typename"` } } `graphql:"issueFields(first: 1)"` // adjust to actual probe shape
} `graphql:"repository(owner: $owner, name: $repo)"`
}
if err := gqlClient.Query(ghcontext.WithGraphQLFeatures(ctx, "issue_fields", "repo_issue_fields"), &probe, vars); err != nil {
return fmt.Errorf("issue fields unavailable for this token/repo: %w", err)
} Try / catch
if err := gqlClient.Query(ctxWithFeatures, &query, vars); err != nil {
msg := err.Error()
switch {
case strings.Contains(msg, "Bad credentials"):
return fmt.Errorf("invalid token")
case strings.Contains(msg, "rate limit"):
time.Sleep(waitForReset())
return retry()
case strings.Contains(msg, "Could not resolve to"):
return fmt.Errorf("repository %s/%s not visible", owner, repo)
}
return fmt.Errorf("issue fields not supported here (preview/GHES?): %w", err)
} Prevention
- Gate issue_fields usage on the repo actually having fields configured
- Keep one proven-good payload per repo as a canary before bulk runs
- Track GraphQL rate-limit headers in long scripts and throttle before hitting limits
When it happens
Trigger: update_issue/create_issue with issue_fields where the repository or token cannot use the issue-fields preview (GitHub returns an error for the previewed selection), 401 bad credentials, GraphQL rate limit exhausted, GHES without issue-fields support, or network failure to the GraphQL endpoint.
Common situations: Orgs/repos where issue fields are not enabled or not rolled out; tokens (fine-grained PATs, GitHub Apps) without the preview; older GHES; scripts burning GraphQL quota; the token can use REST fine but GraphQL fails on previewed fields.
Related errors
- failed to get issue ID: %w
- failed to fetch existing issue field values: %w
- issue field %q was not found in %s/%s
- issue field %q is missing fullDatabaseId
- issue field %q is %q, so field_option_name cannot be used
AI-assisted analysis of github/github-mcp-server@0ea1f775a7 (2026-08-15).
Data as JSON: /api/errors/0530cff2425b4640.
Report an issue: GitHub.