{"record":{"id":"2120cff16f00e4ad","repo":"github/github-mcp-server","slug":"failed-to-build-inventory-for-tool-scope-map-w","errorCode":null,"errorMessage":"failed to build inventory for tool scope map: %w","messagePattern":"failed to build inventory for tool scope map: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"pkg/http/server.go","lineNumber":253,"sourceCode":"\n// resolveListenAddress returns the address string passed to http.Server.\n// When host is empty the server binds to all interfaces on the given port;\n// otherwise host and port are joined into a single address.\nfunc resolveListenAddress(host string, port int) string {\n\tif host == \"\" {\n\t\treturn fmt.Sprintf(\":%d\", port)\n\t}\n\treturn net.JoinHostPort(host, strconv.Itoa(port))\n}\n\nfunc initGlobalToolScopeMap(t translations.TranslationHelperFunc, hostType utils.HostType) error {\n\t// Build inventory with all tools to extract scope information\n\tinv, err := inventory.NewBuilder().\n\t\tSetTools(github.AllTools(t, github.WithHost(hostType))).\n\t\tBuild()\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to build inventory for tool scope map: %w\", err)\n\t}\n\n\t// Initialize the global scope map\n\tscopes.SetToolScopeMapFromInventory(inv)\n\n\treturn nil\n}\n\n// createHTTPFeatureChecker creates a feature checker that resolves static CLI\n// features plus per-request header features and insiders mode.\nfunc createHTTPFeatureChecker(enabledFeatures []string, insidersMode bool) inventory.FeatureFlagChecker {\n\treturn func(ctx context.Context, flag string) (bool, error) {\n\t\theaderFeatures := ghcontext.GetHeaderFeatures(ctx)\n\t\tfeatures := make([]string, 0, len(enabledFeatures)+len(headerFeatures))\n\t\tfeatures = append(features, enabledFeatures...)\n\t\tfeatures = append(features, headerFeatures...)\n\n\t\teffective := github.ResolveFeatureFlags(features, insidersMode || ghcontext.IsInsidersMode(ctx))","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/http/server.go#L235-L271","documentation":"Thrown during HTTP server startup when initGlobalToolScopeMap cannot build the tool inventory that feeds the global tool-to-OAuth-scope map. It runs inventory.NewBuilder().SetTools(github.AllTools(t, github.WithHost(hostType))).Build() over the full tool catalog for the configured host type, so a failure means the static catalog itself is inconsistent for this build/host combination, not bad request input. The wrapped error (%w) names the underlying builder failure.","triggerScenarios":"Starting the server in HTTP/streaming mode when Build() fails while resolving the complete tool set: a toolset definition referencing a tool not registered for the selected host type, or conflicting builder options applied over AllTools. The wrapped error is frequently itself 'unknown tools specified in WithTools' from the same package.","commonSituations":"Upgrading to a release whose tool catalog changed; custom forks adding tools with incomplete registrations; running with a GHES host type where dotcom-only tools are referenced in config.","solutions":["Read the wrapped error after the colon - it names the actual builder failure that must be fixed","Boot the same config in stdio mode to check whether the tool catalog builds at all","Verify --github-host/host-type matches the toolsets enabled: GHES hosts expose fewer tools than dotcom","If the binary is unmodified, file an issue including the version and the full wrapped error chain"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// CI smoke test: prove the catalog builds for every host type you deploy\nfor _, ht := range []utils.HostType{utils.HostTypeDotcom, utils.HostTypeGHES} {\n\tif _, err := inventory.NewBuilder().\n\t\tSetTools(github.AllTools(translations.NullTranslationHelper, github.WithHost(ht))).Build(); err != nil {\n\t\tt.Fatalf(\"tool catalog broken for host %v: %v\", ht, err)\n\t}\n}","typeGuard":null,"tryCatchPattern":"if err := initGlobalToolScopeMap(t, hostType); err != nil {\n\t// not transient: surface the wrapped %w chain and stop - never retry with the same config\n\tlog.Error(\"startup failed: tool scope map\", \"err\", err)\n\tos.Exit(1)\n}","preventionTips":["Smoke-test server startup for each host type in CI so catalog regressions are caught pre-deploy","Pin the server version and re-validate custom tool registrations on every upgrade","Treat this error as a build/config defect, not a runtime condition"],"tags":["go","startup","inventory","host-type","configuration"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}