xai-org/x-algorithm · error · SemanticCheckFailure
MockPass function expects either 1 arguments but %d received
Error message
MockPass function expects either 1 arguments but %d received
What it means
MockPass(fnName) takes exactly one string argument — the name of the function whose mock should be bypassed (pass through to the real implementation). Any other argument count fails.
Source
Thrown at botmaker/src/java/com/twitter/botmaker/compiler/Compiler.java:1256
);
}
} catch (Exception e) {
throw new SemanticCheckFailure(e);
}
return Constant.UNIT;
}
private ASTNode toMockPass(
CompilerContext context,
String exprText,
Tree root) throws SemanticCheckFailure {
try {
if (root.getChildCount() == 2) {
String funcName = toStringConstant(root.getChild(1));
context.addMockPass(funcName);
} else {
throw new SemanticCheckFailure(
String.format("MockPass function expects either 1 arguments but %d received",
root.getChildCount() - 1)
);
}
} catch (Exception e) {
throw new SemanticCheckFailure(e);
}
return Constant.UNIT;
}
private ASTNode toMockPassAll(
CompilerContext context,
String exprText,
Tree root) throws SemanticCheckFailure {
try {
if (root.getChildCount() == 2) {
String packageName = toStringConstant(root.getChild(1));View on GitHub (pinned to 24c60942c5)
Solutions
- Call MockPass with exactly one function-name string literal
- Double-check generated test scaffolding emits a single argument
Example fix
// before
MockPass("getScore", "otherFn")
// after
MockPass("getScore") Defensive patterns
Strategy: validation
Validate before calling
if (mockPassArgs != 1) throw new IllegalArgumentException("MockPass takes exactly 1 arg"); Try / catch
catch (SemanticCheckFailure e) { if (e.getMessage().contains("MockPass")) fixArity(); else throw e; } Prevention
- Emit exactly one quoted function name for MockPass
When it happens
Trigger: `MockPass()` with no args, or `MockPass("a", "b")` with two; also passing a non-string node that makes the count check irrelevant after toStringConstant would throw, but arity errors surface first.
Common situations: Confusing MockPass with Mock argument shapes, or trailing commas/extra tokens in generated test setup expressions.
Related errors
- Mock function expects either 1 or 3 arguments but %d receive
- MockPassAll function expects 1 arguments but %d received
- TestRun 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/64a209ef027a8c0e.
Report an issue: GitHub.