xai-org/x-algorithm · error · ParseFailure
col %d: Unrecognized type: %s
Error message
col %d: Unrecognized type: %s
What it means
TypeCompiler.getType resolves a simple (non-composite) type name from rule context or the primitive table. A name found in neither throws ParseFailure 'col N: Unrecognized type'.
Source
Thrown at botmaker/src/java/com/twitter/botmaker/compiler/types/TypeCompiler.java:49
public static Type getType(
Tree tree,
TypeContext context
) throws ParseFailure, SemanticCheckFailure {
if (tree.getType() == BotMakerLexer.GENERIC_TYPE) {
return getCompositeType(tree, context);
} else if (tree.getChildCount() > 1) {
String className = getFullClassName(tree);
return getTypeFromClassName(className);
} else {
String typeName = tree.getChild(0).getText();
Optional<Type> typeFromContextOpt = context.getTypeFromName(typeName);
Optional<Type> primitiveTypeOpt = getPrimitiveType(typeName);
if (typeFromContextOpt.isPresent()) {
return typeFromContextOpt.get();
} else if (primitiveTypeOpt.isPresent()) {
return primitiveTypeOpt.get();
} else {
throw new ParseFailure(String.format(
"col %d: Unrecognized type: %s",
tree.getCharPositionInLine() + 1, typeName));
}
}
}
private static String getFullClassName(Tree tree) {
StringBuilder builder = new StringBuilder();
builder.append(tree.getChild(0).getText());
for (int index = 1; index < tree.getChildCount(); index++) {
builder.append('.').append(tree.getChild(index).getText());
}
return builder.toString();
}
private static Type getCompositeType(
Tree tree,
TypeContext contextView on GitHub (pinned to 24c60942c5)
Solutions
- Use the exact registered primitive/composite type name (case-sensitive)
- Register the custom type in the TypeContext before compiling
- Check the reported column to find the offending token and fix the typo
Example fix
// before ... : u64 ... // after ... : UINT64 ...
Defensive patterns
Strategy: validation
Validate before calling
Optional<Type> known = getPrimitiveType(name); // plus context lookup if (!known.isPresent() && !contextHas(name)) rejectRule();
Try / catch
catch ParseFailure; use the reported column to point the author at the bad type token
Prevention
- Maintain a list of valid type names in rule tooling
- Case-sensitive linting of type expressions
When it happens
Trigger: Compiling a botmaker rule whose type expression names an unknown simple type — e.g. 'u64' when only UINT64 is registered, or a class name where a type keyword is required.
Common situations: Typos in type names, custom types not registered in the TypeContext, dialect differences between botmaker rule versions.
Related errors
- col %d: Type %s received %d parameters, %d expected
- type checking expression %s failed: invalid argument type: %
- Non-optional parameter %s must be declared before optional p
- Duplicated argument name %s
- Unsupported field type %s
AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28).
Data as JSON: /api/errors/7d8248147619349b.
Report an issue: GitHub.