{"record":{"id":"d104b9a0fe1b4525","repo":"googleapis/mcp-toolbox","slug":"tool-does-not-exist-s-d104b9","errorCode":null,"errorMessage":"tool does not exist: %s","messagePattern":"tool does not exist: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/toolsets.go","lineNumber":101,"sourceCode":"\nfunc (t ToolsetConfig) Initialize(serverVersion string, toolsMap map[string]Tool) (Toolset, error) {\n\t// finish toolset setup\n\t// Check each declared tool name exists\n\ttoolset := Toolset{\n\t\tToolsetConfig: t,\n\t\tTools:         make([]*Tool, 0, len(t.ToolNames)),\n\t\tManifest: ToolsetManifest{\n\t\t\tServerVersion: serverVersion,\n\t\t},\n\t\ttoolNameSet: make(map[string]struct{}, len(t.ToolNames)),\n\t}\n\tif !IsValidName(toolset.Name) {\n\t\treturn toolset, fmt.Errorf(\"invalid toolset name: %s\", toolset.Name)\n\t}\n\tfor _, toolName := range t.ToolNames {\n\t\ttool, ok := toolsMap[toolName]\n\t\tif !ok {\n\t\t\treturn toolset, fmt.Errorf(\"tool does not exist: %s\", toolName)\n\t\t}\n\t\ttoolset.Tools = append(toolset.Tools, &tool)\n\t\ttoolset.toolNameSet[toolName] = struct{}{}\n\t}\n\treturn toolset, nil\n}\n\nvar validName = regexp.MustCompile(`^[a-zA-Z0-9_-]*$`)\n\nfunc IsValidName(s string) bool {\n\treturn validName.MatchString(s)\n}\n","sourceCodeStart":83,"sourceCodeEnd":114,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/toolsets.go#L83-L114","documentation":"Toolset.Initialize resolves each configured tool name against the map of registered tools. If a listed tool name does not exist in toolsMap, Initialize returns this error. The toolset references a tool that was never defined or registered.","triggerScenarios":"Calling Initialize with a Toolset whose ToolNames contains a name absent from toolsMap — the toolset lists a tool that isn't defined in the tools section or wasn't registered in the binary.","commonSituations":"Typo in a tool name inside the toolset list; tool defined under a different key than referenced; tool removed/renamed while toolsets still reference the old name; custom binary missing the package registering the tool.","solutions":["Make the toolset's tool entry exactly match a defined tool key in the tools section","Fix typos in the tool name list","Re-add or rename the missing tool, or remove it from the toolset","Confirm the binary includes the package that registers the referenced tool"],"exampleFix":"// before (tools.yaml)\ntoolsets:\n  my_toolset:\n    - run_queery\n// after\ntoolsets:\n  my_toolset:\n    - run_query","handlingStrategy":"validation","validationCode":"definedTools := map[string]bool{\"run_query\": true} // keys of tools: in config\nfor _, name := range toolset.ToolNames {\n    if !definedTools[name] {\n        return fmt.Errorf(\"toolset lists unknown tool %q\", name)\n    }\n}","typeGuard":null,"tryCatchPattern":"ts, err := t.Initialize(ctx)\nif err != nil {\n    if strings.Contains(err.Error(), \"tool does not exist\") {\n        log.Printf(\"add or fix the tool entry: %v\", err)\n    }\n    return err\n}","preventionTips":["Copy tool names from the tools: section verbatim","Delete stale toolset entries after renaming/removing tools","Keep tools and toolsets in one config file so diffs keep them in sync"],"tags":["go","config","toolset","tool-lookup"],"backgroundTag":"tool-not-found","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}