{"record":{"id":"64a209ef027a8c0e","repo":"xai-org/x-algorithm","slug":"mockpass-function-expects-either-1-arguments-but","errorCode":null,"errorMessage":"MockPass function expects either 1 arguments but %d received","messagePattern":"MockPass function expects either 1 arguments but (.+?) received","errorType":"validation","errorClass":"SemanticCheckFailure","httpStatus":null,"severity":"error","filePath":"botmaker/src/java/com/twitter/botmaker/compiler/Compiler.java","lineNumber":1256,"sourceCode":"        );\n      }\n    } catch (Exception e) {\n      throw new SemanticCheckFailure(e);\n    }\n\n    return Constant.UNIT;\n  }\n\n  private ASTNode toMockPass(\n      CompilerContext context,\n      String exprText,\n      Tree root) throws SemanticCheckFailure {\n    try {\n      if (root.getChildCount() == 2) {\n        String funcName = toStringConstant(root.getChild(1));\n        context.addMockPass(funcName);\n      } else {\n        throw new SemanticCheckFailure(\n            String.format(\"MockPass function expects either 1 arguments but %d received\",\n                root.getChildCount() - 1)\n        );\n      }\n    } catch (Exception e) {\n      throw new SemanticCheckFailure(e);\n    }\n\n    return Constant.UNIT;\n  }\n\n  private ASTNode toMockPassAll(\n      CompilerContext context,\n      String exprText,\n      Tree root) throws SemanticCheckFailure {\n    try {\n      if (root.getChildCount() == 2) {\n        String packageName = toStringConstant(root.getChild(1));","sourceCodeStart":1238,"sourceCodeEnd":1274,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/botmaker/src/java/com/twitter/botmaker/compiler/Compiler.java#L1238-L1274","documentation":"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.","triggerScenarios":"`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.","commonSituations":"Confusing MockPass with Mock argument shapes, or trailing commas/extra tokens in generated test setup expressions.","solutions":["Call MockPass with exactly one function-name string literal","Double-check generated test scaffolding emits a single argument"],"exampleFix":"// before\nMockPass(\"getScore\", \"otherFn\")\n// after\nMockPass(\"getScore\")","handlingStrategy":"validation","validationCode":"if (mockPassArgs != 1) throw new IllegalArgumentException(\"MockPass takes exactly 1 arg\");","typeGuard":null,"tryCatchPattern":"catch (SemanticCheckFailure e) { if (e.getMessage().contains(\"MockPass\")) fixArity(); else throw e; }","preventionTips":["Emit exactly one quoted function name for MockPass"],"tags":["botmaker","mockpass","arity","testing"],"backgroundTag":"function-arity-mismatch","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}