xai-org/x-algorithm · error · SemanticCheckFailure
%s is not a derived feature function
Error message
%s is not a derived feature function
What it means
The expression calls a function that looks like a derived feature invocation, but no DerivedFeature with that name is registered in the compilation context (and it was not caught as a builtin or macro earlier).
Source
Thrown at botmaker/src/java/com/twitter/botmaker/compiler/Compiler.java:1155
if (varExprASTNode.getReturnType() == Type.SYMBOL) {
throw new SemanticCheckFailure("Cannot assign SYMBOL type to variable");
}
return Pair.of(variableName, varExprASTNode);
}
private ASTNode toDerivedFeatureFunction(
CompilerContext context, String funcName, int lineNo, List<ASTNode> children
) throws ParseFailure, SemanticCheckFailure {
if (context.containsMacro(funcName)) {
throw new SemanticCheckFailure(String.format(
"Recursive invocation of derived feature function %s is prohibited", funcName));
}
Optional<DerivedFeature> dfOpt = context.getDerivedFeature(funcName);
if (!dfOpt.isPresent()) {
throw new SemanticCheckFailure(String.format(
"%s is not a derived feature function", funcName));
}
DerivedFeature derivedFeature = dfOpt.get();
context.trackUsage(derivedFeature);
List<Tuple3<Tree, String, Optional<Tree>>> params = derivedFeature.getParams();
boolean isLogged = derivedFeature.isLogged();
List<ASTNode> args = children;
if (params.size() != children.size()) {
if (params.size() < children.size()
|| !params.get(children.size()).getThird().isPresent()) {
throw new SemanticCheckFailure(String.format(
"Derived Feature %s has %d parameters, received %d",
funcName, params.size(), children.size()));
}View on GitHub (pinned to 24c60942c5)
Solutions
- Verify the derived feature name and casing matches its declaration
- Ensure the defining rule/feature file is included in the same compilation
- If the feature was removed, update all call sites
Example fix
// before value = myFeautre(x) // after value = myFeature(x)
Defensive patterns
Strategy: validation
Validate before calling
if (!context.getDerivedFeature(funcName).isPresent() && !builtins.contains(funcName)) throw new IllegalArgumentException("Undeclared derived feature: " + funcName); Try / catch
catch (SemanticCheckFailure e) { if (e.getMessage().contains("is not a derived feature function")) reportMissingFeature(e); else throw e; } Prevention
- Compile feature-defining files before dependent files
- Lint for references to deleted features in CI
When it happens
Trigger: Calling a derived feature that was never declared, was declared in a different rule set/unit, or after a rename; also stale references after deleting a feature.
Common situations: Multi-file rule sets where a feature is used before its defining file is compiled, feature removed during cleanup but references remain, or name casing mistakes.
Related errors
- Recursive invocation of derived feature function %s is prohi
- Derived Feature %s has %d parameters, received %d
- Parameter #%d of %s should be %s, received %s instead
- unrecognized function name:
- class to be imported has to be either a TBase or ThriftStruc
AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28).
Data as JSON: /api/errors/1fec59fd23c098d1.
Report an issue: GitHub.