xai-org/x-algorithm · error · SemanticCheckFailure
Function '%s' does not exist
Error message
Function '%s' does not exist
What it means
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.
Source
Thrown at botmaker/src/java/com/twitter/botmaker/compiler/CompilerBuilder.java:249
return Type.OBJECT;
} else {
throw new SemanticCheckFailure(
String.format("Input Feature %s does not exist", fullFeatureName));
}
}
@Override
protected boolean containsFunction(String name) {
return compilerUnits.containsKey(name);
}
@Override
protected ASTNode createFunctionASTNode(
CompilerContext<E> context,
String funcName,
ImmutableList<ASTNode> children) throws SemanticCheckFailure {
if (!compilerUnits.containsKey(funcName)) {
throw new SemanticCheckFailure(String.format("Function '%s' does not exist", funcName));
}
CompilerUnit compilerUnit = compilerUnits.get(funcName);
if (compilerUnit.fingerprint() != Fingerprint.EMPTY) {
context.trackUsage(compilerUnit);
}
return compilerUnit.createASTNode(children);
}
};
}
}
View on GitHub (pinned to 24c60942c5)
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
Example fix
// before
ASTNode n = compiler.createASTNodeTree(ctx, Parser.createParseTree("mispelledFunction(x)"));
// after
ASTNode n = compiler.createASTNodeTree(ctx, Parser.createParseTree("correctFunctionName(x)")); Defensive patterns
Strategy: validation
Validate before calling
Set<String> known = compilerUnits.keySet(); // or expose from builder
if (!known.contains(funcName)) throw new IllegalArgumentException("Unknown function: " + funcName); Try / catch
catch (SemanticCheckFailure e) { if (e.getMessage().contains("does not exist")) { /* report unknown function */ } throw e; } Prevention
- Maintain an allowlist of function names and validate expressions against it before compilation
- Run compilation in CI to catch stale function references after renames
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- Function '%s' does not exist
- unrecognized function name:
- variable %s not defined
- The mock for function %s is not defined.
- Contains expects input of String, Map, Set or Collection typ
AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28).
Data as JSON: /api/errors/7fdbfacaf9800724.
Report an issue: GitHub.