{"record":{"id":"235c896d7b82c0e6","repo":"vxcontrol/pentagi","slug":"unknown-tool-s-235c89","errorCode":null,"errorMessage":"unknown tool: %s","messagePattern":"unknown tool: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/pkg/tools/guide.go","lineNumber":391,"sourceCode":"\t\t\t}\n\t\t\t_, _ = g.vslp.PutLog(\n\t\t\t\tctx,\n\t\t\t\tagentCtx.ParentAgentType,\n\t\t\t\tagentCtx.CurrentAgentType,\n\t\t\t\tfiltersData,\n\t\t\t\taction.Question,\n\t\t\t\tdatabase.VecstoreActionTypeStore,\n\t\t\t\tguide,\n\t\t\t\tg.taskID,\n\t\t\t\tg.subtaskID,\n\t\t\t)\n\t\t}\n\n\t\treturn \"guide stored successfully\", nil\n\n\tdefault:\n\t\tlogger.Error(\"unknown tool\")\n\t\treturn \"\", fmt.Errorf(\"unknown tool: %s\", name)\n\t}\n}\n\nfunc (g *guide) IsAvailable() bool {\n\treturn g.store != nil\n}\n","sourceCodeStart":373,"sourceCodeEnd":398,"githubUrl":"https://github.com/vxcontrol/pentagi/blob/ea665308baaff015b226f308438a68d929d0f29b/backend/pkg/tools/guide.go#L373-L398","documentation":"The guide tool dispatcher received a tool name that is neither search_guide nor store_guide. The name must exactly match one of the registered switch cases; anything else falls to the default branch and errors out.","triggerScenarios":"Agent calls a guide-family tool with a misspelled or nonexistent name; tool registry wires a wrong name string into guide.Handle; a new guide tool was added to the schema but not to the switch.","commonSituations":"LLM hallucinating tool names; case-sensitivity mismatch (e.g. 'Search_Guide'); adding a tool to the GraphQL/agent schema without updating guide.go; copy-pasted registration passing the wrong ToolName constant.","solutions":["Check the log field 'tool' for the exact unknown name and compare against SearchGuideToolName/StoreGuideToolName constants.","Fix the tool-name registration so guide.Handle only receives names it implements.","If a new tool is intended, add a case to the switch in guide.Handle.","Verify the agent's system prompt/tool list doesn't advertise nonexistent guide tools.","Regenerate the flow if a single model hallucination caused it."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const (\n    SearchGuideToolName = \"search_guide\"\n    StoreGuideToolName  = \"store_guide\"\n)\nfunc isGuideTool(name string) bool {\n    return name == SearchGuideToolName || name == StoreGuideToolName\n}","typeGuard":"func knownGuideTool(name string) (string, bool) {\n    switch name {\n    case SearchGuideToolName, StoreGuideToolName:\n        return name, true\n    }\n    return \"\", false\n}","tryCatchPattern":"out, err := tool.Handle(ctx, name, args)\nif err != nil && strings.HasPrefix(err.Error(), \"unknown tool\") {\n    log.Printf(\"agent called unregistered tool %q; falling back\", name)\n    return fallbackTool.Handle(ctx, name, args)\n}","preventionTips":["Only expose tool names to the agent that the switch implements","Use constants (never string literals) when registering tools","Add a registry test that every advertised tool name resolves in Handle","Review agent prompts after renaming tools to remove stale names"],"tags":["tool-dispatch","unknown-tool","llm"],"backgroundTag":"unknown-tool-name","analyzedSha":"ea665308baaff015b226f308438a68d929d0f29b","analyzedAt":"2026-09-01T14:16:31.421Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}