{"record":{"id":"55f251c40b12b1b1","repo":"github/github-mcp-server","slug":"owner-is-required","errorCode":null,"errorMessage":"owner is required","messagePattern":"owner is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/github/repository_resource.go","lineNumber":126,"sourceCode":"}\n\n// RepositoryResourceContentsHandler returns a handler function for repository content requests.\n// It retrieves ToolDependencies from the context at call time via MustDepsFromContext.\nfunc RepositoryResourceContentsHandler(resourceURITemplate *uritemplate.Template) mcp.ResourceHandler {\n\treturn func(ctx context.Context, request *mcp.ReadResourceRequest) (*mcp.ReadResourceResult, error) {\n\t\tdeps := MustDepsFromContext(ctx)\n\t\t// Match the URI to extract parameters\n\t\turiValues := resourceURITemplate.Match(request.Params.URI)\n\t\tif uriValues == nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to match URI: %s\", request.Params.URI)\n\t\t}\n\n\t\t// Extract required vars\n\t\towner := uriValues.Get(\"owner\").String()\n\t\trepo := uriValues.Get(\"repo\").String()\n\n\t\tif owner == \"\" {\n\t\t\treturn nil, errors.New(\"owner is required\")\n\t\t}\n\n\t\tif repo == \"\" {\n\t\t\treturn nil, errors.New(\"repo is required\")\n\t\t}\n\n\t\tpathValue := uriValues.Get(\"path\")\n\t\tpathComponents := pathValue.List()\n\t\tvar path string\n\n\t\tif len(pathComponents) == 0 {\n\t\t\tpath = pathValue.String()\n\t\t} else {\n\t\t\tpath = strings.Join(pathComponents, \"/\")\n\t\t}\n\n\t\topts := &github.RepositoryContentGetOptions{}\n\t\trawOpts := &raw.ContentOpts{}","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/repository_resource.go#L108-L144","documentation":"get_file_blame runs against the GitHub GraphQL API, so its handler calls deps.GetGQLClient(ctx) instead of GetClient. In per-request deployments (RequestDeps) this resolves token info from the request context and the GraphQL endpoint from apiHosts.GraphqlURL(ctx); failure wraps 'no token info in context' or 'failed to get GraphQL URL'. The REST client can be healthy while this fails if host config lacks a resolvable GraphQL endpoint. The tool is additionally gated by the file-blame feature flag.","triggerScenarios":"Calling get_file_blame when the context carries no token info, or when an enterprise base URL cannot yield a GraphQL endpoint (e.g. GITHUB_BASE_URL set to a host without the /api/graphql path, or GITHUB_API_HOSTS missing the graphql URL).","commonSituations":"Enterprise GitHub Server deployments where REST works but the GraphQL URL derivation fails; missing token on remote servers; disabling or misconfiguring the file-blame feature flag so the tool's dependencies are never exercised.","solutions":["Read the wrapped cause: 'no token info in context' means auth, 'failed to get GraphQL URL' means host config","Provide a valid token to the server process/request","For GitHub Enterprise, ensure the configured base URL yields a valid GraphQL endpoint (e.g. https://github.example.com/api/graphql)","Confirm the file-blame feature flag is enabled so the tool is registered and tested on your deployment"],"exampleFix":"// before: REST tools work, get_file_blame fails\n//   \"failed to get GitHub GraphQL client: failed to get GraphQL URL: ...\"\nexport GITHUB_BASE_URL=\"https://github.example.com\"\n\n// after: host config resolves a GraphQL endpoint\nexport GITHUB_BASE_URL=\"https://github.example.com/api/v3\"   # REST\nexport GITHUB_API_HOSTS=\"github.example.com\"                  # derives /api/graphql","handlingStrategy":"try-catch","validationCode":"// Before enabling blame workflows, confirm token + GraphQL endpoint resolvability.\nfunc preflightGraphQLClient(baseURL string) error {\n\tif os.Getenv(\"GITHUB_PERSONAL_ACCESS_TOKEN\") == \"\" {\n\t\treturn fmt.Errorf(\"missing token: get_file_blame needs a GraphQL client\")\n\t}\n\tu, err := url.Parse(baseURL)\n\tif err != nil || u.Scheme == \"\" || u.Host == \"\" {\n\t\treturn fmt.Errorf(\"GITHUB_BASE_URL must be absolute: %q\", baseURL)\n\t}\n\treturn nil\n}","typeGuard":"func isGraphQLClientError(err error) bool {\n\treturn err != nil && strings.Contains(err.Error(), \"failed to get GitHub GraphQL client\")\n}","tryCatchPattern":"result, _, err := callGetFileBlame(ctx, args)\nif err != nil {\n\tif isGraphQLClientError(err) {\n\t\t// deterministic config fault (token or GraphQL URL): fix env, restart; no retry\n\t\treturn fmt.Errorf(\"server GraphQL auth/host misconfiguration: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["For GitHub Enterprise, verify the configured host yields /api/graphql before shipping blame features","Remember get_file_blame needs GraphQL while most tools use REST - test both paths at boot","Confirm the file-blame feature flag is enabled in your deployment","Alert on 'failed to get GitHub GraphQL client' as config, not load"],"tags":["go","graphql","authentication","configuration"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}