{"record":{"id":"0221c3fa3020aac8","repo":"vxcontrol/pentagi","slug":"builtin-function-s-not-found","errorCode":null,"errorMessage":"builtin function %s not found","messagePattern":"builtin function (.+?) not found","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/pkg/tools/tools.go","lineNumber":784,"sourceCode":"\t}\n\n\treturn nil\n}\n\nfunc (fte *flowToolsExecutor) GetCustomExecutor(cfg CustomExecutorConfig) (ContextToolsExecutor, error) {\n\tif len(cfg.Definitions) != len(cfg.Handlers) {\n\t\treturn nil, fmt.Errorf(\"definitions and handlers must have the same length\")\n\t}\n\n\tfor _, def := range cfg.Definitions {\n\t\tif _, ok := cfg.Handlers[def.Name]; !ok {\n\t\t\treturn nil, fmt.Errorf(\"handler for function %s not found\", def.Name)\n\t\t}\n\t}\n\n\tfor _, builtin := range cfg.Builtin {\n\t\tif def, ok := fte.definitions[builtin]; !ok {\n\t\t\treturn nil, fmt.Errorf(\"builtin function %s not found\", builtin)\n\t\t} else {\n\t\t\tcfg.Definitions = append(cfg.Definitions, def)\n\t\t\tcfg.Handlers[builtin] = fte.handlers[builtin]\n\t\t}\n\t}\n\n\tbarriers := make(map[string]struct{})\n\tfor _, barrier := range cfg.Barriers {\n\t\tif _, ok := fte.handlers[barrier]; !ok {\n\t\t\treturn nil, fmt.Errorf(\"barrier function %s not found\", barrier)\n\t\t}\n\t\tbarriers[barrier] = struct{}{}\n\t}\n\n\treturn &customExecutor{\n\t\tuserID:      fte.userID,\n\t\tflowID:      fte.flowID,\n\t\ttaskID:      cfg.TaskID,","sourceCodeStart":766,"sourceCodeEnd":802,"githubUrl":"https://github.com/vxcontrol/pentagi/blob/ea665308baaff015b226f308438a68d929d0f29b/backend/pkg/tools/tools.go#L766-L802","documentation":"GetCustomExecutor supports pulling in built-in tools by name via cfg.Builtin; each name must exist in the flow executor's fte.definitions registry. If a requested builtin name is unknown, registration aborts with this error naming the missing builtin function.","triggerScenarios":"Passing cfg.Builtin containing a tool name that is not one of the executor's registered builtin definitions — e.g. a typo, a tool name from a different PentAGI version, or a tool that is only registered under a different toolset configuration.","commonSituations":"Hardcoded builtin lists copied from examples that don't match the deployed version's tool registry; renaming a builtin tool and forgetting to update custom executor configs; enabling a builtin that is gated behind a config flag and therefore never registered.","solutions":["Replace the reported name in cfg.Builtin with a valid builtin name registered on the flow executor (check fte.definitions / the tools registry for available names).","Fix typos and align names with the current version's tool registry.","Validate the Builtin list against the available definitions at config load time and log available names on mismatch."],"exampleFix":"// before\nBuiltin: []string{\"terminal_exec\", \"web_serch\"}, // typo\n\n// after\nBuiltin: []string{\"terminal_exec\", \"web_search\"},","handlingStrategy":"validation","validationCode":"available := tools.AvailableBuiltinNames() // or inspect the executor's definitions\nfor _, b := range cfg.Builtin {\n    if !slices.Contains(available, b) {\n        return fmt.Errorf(\"unknown builtin %q; available: %v\", b, available)\n    }\n}","typeGuard":"func builtinsKnown(known map[string]tools.FunctionDefinition, names []string) bool {\n    for _, n := range names {\n        if _, ok := known[n]; !ok {\n            return false\n        }\n    }\n    return true\n}","tryCatchPattern":"executor, err := flowTools.GetCustomExecutor(cfg)\nif err != nil && strings.Contains(err.Error(), \"builtin function\") {\n    return fmt.Errorf(\"stale builtin tool name in config: %w\", err)\n}","preventionTips":["Source builtin names from constants exported by the tools package instead of raw string literals.","When upgrading PentAGI, diff the tool registry against custom executor configs.","Log the list of registered builtins at startup to make typos and renames obvious."],"tags":["go","validation","tools-api"],"backgroundTag":"unknown-tool-name","analyzedSha":"ea665308baaff015b226f308438a68d929d0f29b","analyzedAt":"2026-09-01T14:16:31.421Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}