{"record":{"id":"eb2fd97c50832c71","repo":"xai-org/x-algorithm","slug":"testrun-function-expects-1-arguments-but-d-receiv","errorCode":null,"errorMessage":"TestRun function expects 1 arguments but %d received","messagePattern":"TestRun function expects 1 arguments but (.+?) received","errorType":"validation","errorClass":"SemanticCheckFailure","httpStatus":null,"severity":"error","filePath":"botmaker/src/java/com/twitter/botmaker/compiler/Compiler.java","lineNumber":1296,"sourceCode":"            String.format(\"MockPassAll function expects 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 toTestRun(\n      CompilerContext context,\n      String exprText,\n      Tree root) throws SemanticCheckFailure {\n    try {\n\n      if (root.getChildCount() != 2) {\n        throw new SemanticCheckFailure(\n            String.format(\"TestRun function expects 1 arguments but %d received\",\n                root.getChildCount() - 1)\n        );\n      }\n\n      context.addScope();\n      context.addTestScope();\n      Tree target = root.getChild(1);\n      ASTNode node = createASTNodeTree(context, target);\n      ASTNode testRun = new TestRun(\"TestRun\", ImmutableList.of(node));\n\n      context.removeTestScope();\n      context.removeScope();\n      return testRun;\n    } catch (Exception e) {\n      throw new SemanticCheckFailure(e);\n    }\n  }","sourceCodeStart":1278,"sourceCodeEnd":1314,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/botmaker/src/java/com/twitter/botmaker/compiler/Compiler.java#L1278-L1314","documentation":"TestRun(name) takes exactly one argument identifying the test run block. The compiler checks childCount != 2 (function token + one arg) and rejects everything else.","triggerScenarios":"`TestRun()` with no argument or `TestRun(\"a\", \"b\")` with more than one.","commonSituations":"Templated/generated test harnesses that conditionally omit the run name or append extra config arguments not supported by this construct.","solutions":["Pass exactly one identifier/string argument to TestRun","Fix the template that generates the TestRun invocation"],"exampleFix":"// before\nTestRun()\n// after\nTestRun(\"baseline\")","handlingStrategy":"validation","validationCode":"if (testRunArgs != 1) throw new IllegalArgumentException(\"TestRun takes exactly 1 arg\");","typeGuard":null,"tryCatchPattern":"catch (SemanticCheckFailure e) { if (e.getMessage().contains(\"TestRun\")) fixArity(); else throw e; }","preventionTips":["Always name test runs with a single identifier"],"tags":["botmaker","testrun","arity","testing"],"backgroundTag":"function-arity-mismatch","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}