{"record":{"id":"a9f9f3361fd68574","repo":"github/github-mcp-server","slug":"label-s-not-found-in-s-s","errorCode":null,"errorMessage":"label '%s' not found in %s/%s","messagePattern":"label '(.+?)' not found in (.+?)/(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/github/labels.go","lineNumber":458,"sourceCode":"func getLabelID(ctx context.Context, client *githubv4.Client, owner, repo, labelName string) (githubv4.ID, error) {\n\tvar query struct {\n\t\tRepository struct {\n\t\t\tLabel struct {\n\t\t\t\tID   githubv4.ID\n\t\t\t\tName githubv4.String\n\t\t\t} `graphql:\"label(name: $name)\"`\n\t\t} `graphql:\"repository(owner: $owner, name: $repo)\"`\n\t}\n\tvars := map[string]any{\n\t\t\"owner\": githubv4.String(owner),\n\t\t\"repo\":  githubv4.String(repo),\n\t\t\"name\":  githubv4.String(labelName),\n\t}\n\tif err := client.Query(ctx, &query, vars); err != nil {\n\t\treturn \"\", err\n\t}\n\tif query.Repository.Label.Name == \"\" {\n\t\treturn \"\", fmt.Errorf(\"label '%s' not found in %s/%s\", labelName, owner, repo)\n\t}\n\treturn query.Repository.Label.ID, nil\n}\n","sourceCodeStart":440,"sourceCodeEnd":462,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/labels.go#L440-L462","documentation":"getLabelID runs a GraphQL label(name:) lookup (used by label update/delete to resolve the node ID) and treats an empty returned name as not-found. The message names the label and owner/repo. Note the GraphQL API matches label names case-sensitively, so 'bug' will not find 'Bug'.","triggerScenarios":"Calling update_label/delete_label with a name that does not exist exactly as typed in owner/repo, or a name the token cannot see (no access to the repo).","commonSituations":"Case mismatch ('Bug' vs 'bug'); label renamed or deleted concurrently; wrong owner/repo; token lacking read access so the repository field yields empty.","solutions":["List labels first (list_labels) and copy the exact, case-correct name","Create the label first if it should exist","Verify owner/repo spelling and that the token can access the repository"],"exampleFix":"// before\n{\"owner\":\"octo\",\"repo\":\"kit\",\"name\":\"bug\",\"color\":\"ff0000\",\"method\":\"update\"}\n// after\n{\"owner\":\"octo\",\"repo\":\"kit\",\"name\":\"Bug\",\"color\":\"ff0000\",\"method\":\"update\"}","handlingStrategy":"validation","validationCode":"func resolveLabelNameExact(owner, repo, want string) (string, error) {\n\tlabels := listLabels(owner, repo) // via list_labels tool or GET /repos/{o}/{r}/labels\n\tfor _, l := range labels {\n\t\tif l.Name == want {\n\t\t\treturn l.Name, nil\n\t\t}\n\t\tif strings.EqualFold(l.Name, want) {\n\t\t\treturn l.Name, nil // case-insensitive rescue\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"label %q not found; available: %v\", want, names(labels))\n}","typeGuard":"func labelExists(name string, existing []string) bool {\n\tfor _, l := range existing {\n\t\tif l == name {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}","tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"not found in\") {\n    // Re-list labels, pick the exact name (case-sensitive), then retry the mutation.\n}","preventionTips":["Always resolve label names from list_labels before update/delete","Treat label names as case-sensitive even though GitHub displays them uppercased"],"tags":["labels","not-found","case-sensitivity","graphql"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}