{"record":{"id":"ed189884989c56a6","repo":"xai-org/x-algorithm","slug":"function-s-does-not-exist-ed1898","errorCode":null,"errorMessage":"Function '%s' does not exist","messagePattern":"Function '(.+?)' does not exist","errorType":"validation","errorClass":"SemanticCheckFailure","httpStatus":null,"severity":"error","filePath":"botmaker/src/java/com/twitter/botmaker/compiler/CompilerScope.java","lineNumber":119,"sourceCode":"  }\n\n  void defineType(ThriftStructType thriftStructType, String alias) {\n    thriftStructTypes.put(alias, thriftStructType);\n    for (CompilerUnit c : CompilerUnit.of(alias, thriftStructType)) {\n      compilerUnits.put(c.funcName(), c);\n    }\n  }\n\n  boolean containsFunction(String name) {\n    return compilerUnits.containsKey(name);\n  }\n\n  ASTNode createFunctionASTNode(\n      CompilerContext context,\n      String funcName,\n      ImmutableList<ASTNode> children) throws SemanticCheckFailure {\n    if (!compilerUnits.containsKey(funcName)) {\n      throw new SemanticCheckFailure(String.format(\"Function '%s' does not exist\", funcName));\n    }\n\n    CompilerUnit compilerUnit = compilerUnits.get(funcName);\n    if (compilerUnit.fingerprint() != Fingerprint.EMPTY) {\n      context.trackUsage(compilerUnit);\n    }\n\n    return compilerUnit.createASTNode(children);\n  }\n\n  @Override\n  public Optional<Type> getTypeFromName(String typeName) {\n    if (thriftTypes.containsKey(typeName)) {\n      return Optional.of(thriftTypes.get(typeName));\n    } else if (thriftStructTypes.containsKey(typeName)) {\n      return Optional.of(thriftStructTypes.get(typeName));\n    } else {\n      return surrounding.getTypeFromName(typeName);","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/botmaker/src/java/com/twitter/botmaker/compiler/CompilerScope.java#L101-L137","documentation":"CompilerScope's own createFunctionASTNode mirrors CompilerBuilder's: it looks up funcName in compilerUnits and throws if absent. Scope-level function application requires the function to be registered in the scope's unit set.","triggerScenarios":"A function application node compiled through CompilerScope when the function name is not in its compilerUnits map — unknown function, missing import of the defining unit, or a typo.","commonSituations":"Same as builder-level: renames, missing unit registration, version drift, typos in DSL function names.","solutions":["Fix the function name spelling","Register/import the CompilerUnit providing the function into the scope's units","Pre-validate the function name against the available unit set before compiling"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!scopeCompilerUnits.containsKey(funcName)) throw new IllegalArgumentException(\"Unknown function: \" + funcName);","typeGuard":null,"tryCatchPattern":"catch (SemanticCheckFailure e) { /* verify function is registered in this scope's units */ }","preventionTips":["Register all dependent CompilerUnits before compiling","Pre-validate names against the unit registry"],"tags":["botmaker","compiler","name-resolution","semantic-check"],"backgroundTag":"undefined-function-reference","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}