xai-org/x-algorithm · error · SemanticCheckFailure
TestRun function expects 1 arguments but %d received
Error message
TestRun function expects 1 arguments but %d received
What it means
TestRun(name) takes exactly one argument identifying the test run block. The compiler checks childCount != 2 (function token + one arg) and rejects everything else.
Source
Thrown at botmaker/src/java/com/twitter/botmaker/compiler/Compiler.java:1296
String.format("MockPassAll function expects 1 arguments but %d received",
root.getChildCount() - 1)
);
}
} catch (Exception e) {
throw new SemanticCheckFailure(e);
}
return Constant.UNIT;
}
private ASTNode toTestRun(
CompilerContext context,
String exprText,
Tree root) throws SemanticCheckFailure {
try {
if (root.getChildCount() != 2) {
throw new SemanticCheckFailure(
String.format("TestRun function expects 1 arguments but %d received",
root.getChildCount() - 1)
);
}
context.addScope();
context.addTestScope();
Tree target = root.getChild(1);
ASTNode node = createASTNodeTree(context, target);
ASTNode testRun = new TestRun("TestRun", ImmutableList.of(node));
context.removeTestScope();
context.removeScope();
return testRun;
} catch (Exception e) {
throw new SemanticCheckFailure(e);
}
}View on GitHub (pinned to 24c60942c5)
Solutions
- Pass exactly one identifier/string argument to TestRun
- Fix the template that generates the TestRun invocation
Example fix
// before
TestRun()
// after
TestRun("baseline") Defensive patterns
Strategy: validation
Validate before calling
if (testRunArgs != 1) throw new IllegalArgumentException("TestRun takes exactly 1 arg"); Try / catch
catch (SemanticCheckFailure e) { if (e.getMessage().contains("TestRun")) fixArity(); else throw e; } Prevention
- Always name test runs with a single identifier
When it happens
Trigger: `TestRun()` with no argument or `TestRun("a", "b")` with more than one.
Common situations: Templated/generated test harnesses that conditionally omit the run name or append extra config arguments not supported by this construct.
Related errors
- Mock function expects either 1 or 3 arguments but %d receive
- MockPass function expects either 1 arguments but %d received
- MockPassAll function expects 1 arguments but %d received
- Derived Feature %s has %d parameters, received %d
- The mock for function %s is not defined.
AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28).
Data as JSON: /api/errors/eb2fd97c50832c71.
Report an issue: GitHub.