xai-org/x-algorithm · error · SemanticCheckFailure
field %s not found in the metadata of thrift class %s
Error message
field %s not found in the metadata of thrift class %s
What it means
ThriftType.getFieldType resolves a field against the class's apache-thrift FieldMetaData map. A null lookup means the TBase class has no such thrift field, and SemanticCheckFailure is thrown.
Source
Thrown at botmaker/src/java/com/twitter/botmaker/compiler/types/ThriftType.java:166
throw new SemanticCheckFailure(
String.format("Unsupported field type %s", valueMetaData.type));
}
}
@Override
public Set<String> getFieldNames() {
return metadataMap.keySet();
}
public FieldMetaData getFieldMetadata(String fieldName) {
return metadataMap.get(fieldName);
}
@Override
public Type getFieldType(String fieldName) throws SemanticCheckFailure {
FieldMetaData metaData = metadataMap.get(fieldName);
if (metaData == null) {
throw new SemanticCheckFailure(
String.format("field %s not found in the metadata of thrift class %s",
fieldName, typeBase.getName()));
}
FieldValueMetaData valueMetaData = metaData.valueMetaData;
return valueMetaData.getType();
}
@SuppressWarnings("unchecked")
@Override
public boolean isSetValue(TBase thriftObj, String fieldName) {
FieldMetaData metaData = metadataMap.get(fieldName);
return thriftObj.isSet(thriftObj.fieldForId(metaData.fieldId));
}
@SuppressWarnings("unchecked")
@Override
public Object getFieldValue(TBase thriftObj, String fieldName) {View on GitHub (pinned to 24c60942c5)
Solutions
- Use the exact thrift field name from the generated class's metadataMap (check getFieldNames())
- Regenerate/redeploy thrift classes matching the rule
- Remove references to deleted fields
Example fix
// before
thriftType.getFieldType("user_name"); // thrift field is 'username'
// after
thriftType.getFieldType("username"); Defensive patterns
Strategy: type-guard
Validate before calling
if (!thriftType.getFieldNames().contains(fieldName)) { /* fail fast */ } Type guard
boolean hasField(ThriftType t, String f) { return t.getFieldNames().contains(f); } Try / catch
catch SemanticCheckFailure; reject rule at load time with unknown field diagnostics
Prevention
- Validate field names at rule deployment, not runtime
- Regenerate and redeploy thrift jars with every schema change
When it happens
Trigger: Calling getFieldType(fieldName) (usually via fieldType(...)) with a name not present in the TBase struct's metadata map — typo, renamed field, or referencing a field from a different struct.
Common situations: Rules written against an older/newer thrift IDL than the generated classes on the classpath; field renamed or removed in the IDL; camelCase vs snake_case confusion in field names.
Related errors
- field %s not found in the metadata of thrift class %s
- Unsupported field type %s
- Unsupported field type %s
- Unsupported field type %s
- Field %s is not defined in thrift type %s
AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28).
Data as JSON: /api/errors/a1d63eaedc99a42a.
Report an issue: GitHub.