xai-org/x-algorithm · error · SemanticCheckFailure

MockPassAll function expects 1 arguments but %d received

Error message

MockPassAll function expects 1 arguments but %d received

What it means

MockPassAll(packageName) takes exactly one string argument naming a package whose function mocks should all be bypassed. Any other argument count is rejected.

Source

Thrown at botmaker/src/java/com/twitter/botmaker/compiler/Compiler.java:1277

        );
      }
    } 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));
        context.addMockPackage(packageName);
      } else {
        throw new SemanticCheckFailure(
            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) {

View on GitHub (pinned to 24c60942c5)

Solutions

  1. Emit one MockPassAll per package
  2. Ensure the single argument is a quoted package-name string

Example fix

// before
MockPassAll("com.a", "com.b")
// after
MockPassAll("com.a")
MockPassAll("com.b")
Defensive patterns

Strategy: validation

Validate before calling

if (mockPassAllArgs != 1) throw new IllegalArgumentException("MockPassAll takes exactly 1 package arg");

Try / catch

catch (SemanticCheckFailure e) { if (e.getMessage().contains("MockPassAll")) fixArity(); else throw e; }

Prevention

When it happens

Trigger: `MockPassAll()` with no argument, or `MockPassAll("com.a", "com.b")` with multiple packages.

Common situations: Attempting to pass multiple packages in one call instead of repeated MockPassAll calls, or omitting the argument in templated test setups.

Related errors


AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28). Data as JSON: /api/errors/216101036f4a73fa. Report an issue: GitHub.