{"record":{"id":"7fdbfacaf9800724","repo":"xai-org/x-algorithm","slug":"function-s-does-not-exist","errorCode":null,"errorMessage":"Function '%s' does not exist","messagePattern":"Function '(.+?)' does not exist","errorType":"validation","errorClass":"SemanticCheckFailure","httpStatus":null,"severity":"error","filePath":"botmaker/src/java/com/twitter/botmaker/compiler/CompilerBuilder.java","lineNumber":249,"sourceCode":"          return Type.OBJECT;\n        } else {\n          throw new SemanticCheckFailure(\n              String.format(\"Input Feature %s does not exist\", fullFeatureName));\n        }\n      }\n\n      @Override\n      protected boolean containsFunction(String name) {\n        return compilerUnits.containsKey(name);\n      }\n\n      @Override\n      protected ASTNode createFunctionASTNode(\n          CompilerContext<E> context,\n          String funcName,\n          ImmutableList<ASTNode> children) throws SemanticCheckFailure {\n        if (!compilerUnits.containsKey(funcName)) {\n          throw new SemanticCheckFailure(String.format(\"Function '%s' does not exist\", funcName));\n        }\n\n        CompilerUnit compilerUnit = compilerUnits.get(funcName);\n        if (compilerUnit.fingerprint() != Fingerprint.EMPTY) {\n          context.trackUsage(compilerUnit);\n        }\n\n        return compilerUnit.createASTNode(children);\n      }\n    };\n  }\n}\n","sourceCodeStart":231,"sourceCodeEnd":262,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/botmaker/src/java/com/twitter/botmaker/compiler/CompilerBuilder.java#L231-L262","documentation":"Thrown during AST construction when a function name referenced in a BotMaker expression has no corresponding CompilerUnit registered in the CompilerBuilder. It is a semantic-check failure meaning the name resolution of the function failed at compile time, before any runtime evaluation.","triggerScenarios":"Calling compiler.createASTNodeTree on a tree containing a function application whose head symbol is not present in the compilerUnits map (e.g. a typo'd function name, a function defined in another unit that was never imported/registered, or a builtin that was removed).","commonSituations":"Renaming or deleting a library function without updating expressions; forgetting to include a dependency compiler unit when composing the builder; typos in DSL strings; version upgrades where functions were renamed.","solutions":["Check the exact function name in the expression string for typos and casing","Ensure the CompilerUnit that defines the function is registered/loaded into the CompilerBuilder before compiling","If the function was renamed in a newer version, update the expression to the new name","Add a pre-check that the function exists in the known function set before compiling"],"exampleFix":"// before\nASTNode n = compiler.createASTNodeTree(ctx, Parser.createParseTree(\"mispelledFunction(x)\"));\n// after\nASTNode n = compiler.createASTNodeTree(ctx, Parser.createParseTree(\"correctFunctionName(x)\"));","handlingStrategy":"validation","validationCode":"Set<String> known = compilerUnits.keySet(); // or expose from builder\nif (!known.contains(funcName)) throw new IllegalArgumentException(\"Unknown function: \" + funcName);","typeGuard":null,"tryCatchPattern":"catch (SemanticCheckFailure e) { if (e.getMessage().contains(\"does not exist\")) { /* report unknown function */ } throw e; }","preventionTips":["Maintain an allowlist of function names and validate expressions against it before compilation","Run compilation in CI to catch stale function references after renames"],"tags":["botmaker","compiler","name-resolution","semantic-check"],"backgroundTag":"undefined-function-reference","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}