{"record":{"id":"4af29b86bd890014","repo":"github/github-mcp-server","slug":"failed-to-build-inventory-w","errorCode":null,"errorMessage":"failed to build inventory: %w","messagePattern":"failed to build inventory: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/github-mcp-server/list_scopes.go","lineNumber":126,"sourceCode":"\tt, _ := translations.TranslationHelper()\n\n\t// Build inventory using the same logic as the stdio server\n\tinventoryBuilder := github.NewInventory(t).\n\t\tWithReadOnly(readOnly)\n\n\t// Configure toolsets (same as stdio)\n\tif enabledToolsets != nil {\n\t\tinventoryBuilder = inventoryBuilder.WithToolsets(enabledToolsets)\n\t}\n\n\t// Configure specific tools\n\tif len(enabledTools) > 0 {\n\t\tinventoryBuilder = inventoryBuilder.WithTools(enabledTools)\n\t}\n\n\tinv, err := inventoryBuilder.Build()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to build inventory: %w\", err)\n\t}\n\n\t// Collect all tools and their scopes\n\toutput := collectToolScopes(inv, readOnly)\n\n\t// Output based on format\n\tswitch outputFormat {\n\tcase \"json\":\n\t\treturn outputJSON(output)\n\tcase \"summary\":\n\t\treturn outputSummary(output)\n\tdefault:\n\t\treturn outputText(output)\n\t}\n}\n\nfunc collectToolScopes(inv *inventory.Inventory, readOnly bool) ScopesOutput {\n\tvar tools []ToolScopeInfo","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/cmd/github-mcp-server/list_scopes.go#L108-L144","documentation":"Returned by runListScopes when inventoryBuilder.Build() fails while constructing the tool inventory for the list-scopes report. Build() applies read-only filtering, toolset selection, and WithTools validation; in this code path the dominant concrete cause is inventory.ErrUnknownTools (unrecognized names in the 'tools' config), surfaced here wrapped as 'failed to build inventory: unknown tools specified in WithTools: <names>'.","triggerScenarios":"Config 'tools' contains names that are neither registered tools nor deprecated aliases (typo, removed/renamed tool, toolset name used as a tool name); WithTools([]string{...}) fed directly with invalid names when embedding. Read-only mode silently filters write tools, so readOnly itself is not the trigger.","commonSituations":"Upgrading github-mcp-server after tool consolidation and keeping old tool names in config; confusing toolset names ('repos', 'issues') with tool names; configs copied from outdated docs or another fork.","solutions":["Read the wrapped message — it enumerates the exact unrecognized tool names","Correct or remove those names, using current canonical names from the repo docs (docs/tool-renaming.md maps old to new)","If you meant a whole toolset, move the value to the 'toolsets' config key instead","Re-run list-scopes after fixing config; it should build and print scopes"],"exampleFix":"# before (config.yml)\ntools: [\"create_issue\", \"add_issue_comment\"]\n\n# after (post-rename canonical names)\ntools: [\"issue\", \"issue_comment\"]","handlingStrategy":"validation","validationCode":"// Validate configured tool names against a default inventory before Build\ncheckInv, err := github.NewInventory(t).Build()\nif err == nil {\n    known := map[string]bool{}\n    for _, name := range checkInv.AllToolNames() { // expose/collect names as available\n        known[name] = true\n    }\n    for _, n := range enabledTools {\n        if !known[n] {\n            log.Fatalf(\"unknown tool %q — see docs/tool-renaming.md for canonical names\", n)\n        }\n    }\n}\ninv, err := inventoryBuilder.Build()","typeGuard":"// Narrow build failures to the config sentinel\nfunc isUnknownToolsErr(err error) bool {\n    return err != nil && errors.Is(err, inventory.ErrUnknownTools)\n}","tryCatchPattern":"inv, err := inventoryBuilder.Build()\nif err != nil {\n    if errors.Is(err, inventory.ErrUnknownTools) {\n        // message lists the bad names; surface them to the user as a config error\n        fmt.Fprintf(os.Stderr, \"fix your 'tools' config: %v\\n\", err)\n        os.Exit(2)\n    }\n    return fmt.Errorf(\"failed to build inventory: %w\", err)\n}","preventionTips":["Treat this as a config error: the wrapped message enumerates invalid names — fix and restart","Re-validate tool names after every server upgrade (renames are common)","Add a preflight (list-scopes or a dry build) to config pipelines in CI","Prefer toolsets over individual tool names to reduce rename churn"],"tags":["configuration","tool-names","inventory","cli","startup"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}