{"record":{"id":"a1d63eaedc99a42a","repo":"xai-org/x-algorithm","slug":"field-s-not-found-in-the-metadata-of-thrift-class-a1d63e","errorCode":null,"errorMessage":"field %s not found in the metadata of thrift class %s","messagePattern":"field (.+?) not found in the metadata of thrift class (.+?)","errorType":"exception","errorClass":"SemanticCheckFailure","httpStatus":null,"severity":"error","filePath":"botmaker/src/java/com/twitter/botmaker/compiler/types/ThriftType.java","lineNumber":166,"sourceCode":"        throw new SemanticCheckFailure(\n            String.format(\"Unsupported field type %s\", valueMetaData.type));\n    }\n  }\n\n  @Override\n  public Set<String> getFieldNames() {\n    return metadataMap.keySet();\n  }\n\n  public FieldMetaData getFieldMetadata(String fieldName) {\n    return metadataMap.get(fieldName);\n  }\n\n  @Override\n  public Type getFieldType(String fieldName) throws SemanticCheckFailure {\n    FieldMetaData metaData = metadataMap.get(fieldName);\n    if (metaData == null) {\n      throw new SemanticCheckFailure(\n          String.format(\"field %s not found in the metadata of thrift class %s\",\n              fieldName, typeBase.getName()));\n    }\n\n    FieldValueMetaData valueMetaData = metaData.valueMetaData;\n    return valueMetaData.getType();\n  }\n\n  @SuppressWarnings(\"unchecked\")\n  @Override\n  public boolean isSetValue(TBase thriftObj, String fieldName) {\n    FieldMetaData metaData = metadataMap.get(fieldName);\n    return thriftObj.isSet(thriftObj.fieldForId(metaData.fieldId));\n  }\n\n  @SuppressWarnings(\"unchecked\")\n  @Override\n  public Object getFieldValue(TBase thriftObj, String fieldName) {","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/botmaker/src/java/com/twitter/botmaker/compiler/types/ThriftType.java#L148-L184","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nthriftType.getFieldType(\"user_name\"); // thrift field is 'username'\n// after\nthriftType.getFieldType(\"username\");","handlingStrategy":"type-guard","validationCode":"if (!thriftType.getFieldNames().contains(fieldName)) { /* fail fast */ }","typeGuard":"boolean hasField(ThriftType t, String f) { return t.getFieldNames().contains(f); }","tryCatchPattern":"catch SemanticCheckFailure; reject rule at load time with unknown field diagnostics","preventionTips":["Validate field names at rule deployment, not runtime","Regenerate and redeploy thrift jars with every schema change"],"tags":["thrift","field-lookup","schema-validation"],"backgroundTag":"unknown-thrift-field","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}