xai-org/x-algorithm · error · SemanticCheckFailure

unrecognized function name:

Error message

unrecognized function name: 

What it means

Botmaker's DSL compiler encountered a function name it cannot resolve. After trying builtins, derived features, and mock definitions, botmakerFunctionToASTNode has no handler for the given function token, so the expression fails semantic checking at compile time.

Source

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

      }
      return result;
    }

    if (context.containsFunction(funcName)) {
      childASTNodes = getChildrenASTNodesSkippingFirst(context, root);
      try {
        result = context.createFunctionASTNode(funcName, childASTNodes);
      } catch (Exception functionException) {
        try {
          result = toDerivedFeatureFunction(context, funcName, root.getLine(), childASTNodes);
        } catch (Exception dfException) {
          throw functionException;
        }
      }
      return result;
    }

    throw new SemanticCheckFailure("unrecognized function name: " + funcName);
  }

  private ASTNode toDoOperations(
      CompilerContext context,
      String exprText, ImmutableList<ASTNode> children,
      BuiltinFunctions funcNameEnum) throws SemanticCheckFailure {
    switch (funcNameEnum) {
      case Do:
        return new Do(exprText, children);
      case DoAsync:
        return new DoAsync(exprText, children);
      case DoSequential:
        return new DoSequential(exprText, children);
      default:
        throw new SemanticCheckFailure(
            "programming error: unknown Do* operation " + funcNameEnum);
    }
  }

View on GitHub (pinned to 24c60942c5)

Solutions

  1. Check the exact spelling and case of the function name in the expression
  2. Verify the function is a supported builtin or a defined DerivedFeature in the same compilation context
  3. If the function lives elsewhere, define/import it before use
  4. Consult the builtin function enum (BuiltinFunctions) for available names

Example fix

// before
Score = compuetScore(features)
// after
Score = computeScore(features)
Defensive patterns

Strategy: validation

Validate before calling

Set<String> known = builtinNames(); known.addAll(declaredDerivedFeatures);
if (!known.contains(funcName)) throw new IllegalArgumentException("Unknown function: " + funcName);

Try / catch

catch (SemanticCheckFailure e) { if (e.getMessage().startsWith("unrecognized function name")) reportUnknownFunction(e); else throw e; }

Prevention

When it happens

Trigger: Calling an undefined or misspelled function in a Botmaker rule/feature expression, e.g. `MyFunc(x)` where MyFunc is neither a BuiltinFunctions entry nor a registered derived feature; also happens after renaming/removing a derived feature while stale expressions still reference it.

Common situations: Typos in function names, using a function from a newer/older Botmaker version, referencing a derived feature defined in another compilation unit, or forgetting to declare/import the function before use.

Related errors


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