{"record":{"id":"2f1d8560fab04b3a","repo":"xai-org/x-algorithm","slug":"cannot-load-thriftunion-fieldinfos-for-s-s","errorCode":null,"errorMessage":"Cannot load ThriftUnion fieldInfos for %s: $s","messagePattern":"Cannot load ThriftUnion fieldInfos for (.+?): \\$s","errorType":"exception","errorClass":"SemanticCheckFailure","httpStatus":null,"severity":"error","filePath":"botmaker/src/java/com/twitter/botmaker/compiler/types/ThriftStructType.java","lineNumber":377,"sourceCode":"        JavaConverters.seqAsJavaList(codec.metaData().fieldInfos());\n    return fieldInfos;\n  }\n\n  private static List<ThriftStructFieldInfo> getUnionFieldInfos(\n      ThriftStructCodec codec) throws SemanticCheckFailure {\n    try {\n      Method fieldInfosMethod = codec.getClass().getMethod(\"fieldInfos\");\n      List<ThriftUnionFieldInfo> fieldInfos =\n          JavaConverters.seqAsJavaList(\n              (scala.collection.Seq<ThriftUnionFieldInfo>) fieldInfosMethod.invoke(codec));\n\n      ImmutableList.Builder<ThriftStructFieldInfo> builder = ImmutableList.builder();\n      for (ThriftUnionFieldInfo fieldInfo : fieldInfos) {\n        builder.add(fieldInfo.structFieldInfo());\n      }\n      return builder.build();\n    } catch (Exception e) {\n      throw new SemanticCheckFailure(\n          String.format(\"Cannot load ThriftUnion fieldInfos for %s: $s\",\n              codec.getClass().getName(), e.toString()));\n    }\n  }\n\n  private static class TBotMakerMapProtocol extends TProtocol {\n\n    public interface Scope {\n\n      FieldValueMetaData getMetaData();\n\n      Object getValue();\n    }\n\n    public interface StructScope extends Scope {\n      TField readField();\n    }\n","sourceCodeStart":359,"sourceCodeEnd":395,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/botmaker/src/java/com/twitter/botmaker/compiler/types/ThriftStructType.java#L359-L395","documentation":"getUnionFieldInfos reflectively reads ThriftUnionFieldInfo array from a scrooge union's codec to build field info. Any exception during that reflective read is wrapped in SemanticCheckFailure naming the codec class.","triggerScenarios":"Constructing a ThriftStructType over a ThriftUnion whose codec does not expose the expected union FieldInfos field/method — incompatible scrooge version, non-union struct passed where a union is expected, or shaded companion classes.","commonSituations":"Scrooge runtime version differs from the version that generated the union classes; jar conflicts putting two scrooge versions on the classpath; referring to a union type in a botmaker rule after an IDL/toolchain upgrade.","solutions":["Pin scrooge-runtime to the same version used to generate the thrift classes","Evict duplicate scrooge/thrift jars from the dependency tree (check for classpath conflicts)","Regenerate the union classes and redeploy together with botmaker"],"exampleFix":"// before\n// pom: scrooge-runtime 21.2.0, generated code from 24.x -> reflective read fails\n// after\n<dependency><groupId>com.twitter</groupId><artifactId>scrooge-runtime</artifactId><version>24.x</version></dependency>","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch SemanticCheckFailure 'Cannot load ThriftUnion fieldInfos'; instruct checking scrooge-runtime version alignment","preventionTips":["Pin scrooge-runtime to the codegen version","Run dependency:tree to evict duplicate scrooge jars"],"tags":["thrift","scrooge","reflection","dependency-conflict"],"backgroundTag":"dependency-version-mismatch","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}