{"record":{"id":"ce2e1004e74b07a3","repo":"xai-org/x-algorithm","slug":"field-name-s-is-not-found-in-struct-tuple-class","errorCode":null,"errorMessage":"field name %s is not found in struct tuple class %s","messagePattern":"field name (.+?) is not found in struct tuple class (.+?)","errorType":"exception","errorClass":"SemanticCheckFailure","httpStatus":null,"severity":"error","filePath":"botmaker/src/java/com/twitter/botmaker/compiler/types/StructTupleType.java","lineNumber":139,"sourceCode":"\n  @Override\n  public Set<String> getFieldNames() {\n    Set<String> fNames = Sets.newHashSetWithExpectedSize(fieldNames.size() * 2);\n    fNames.addAll(fieldNames);\n    for (int i = 0; i < fieldNames.size(); ++i) {\n      fNames.add(\"_\" + (i + 1));\n    }\n    return ImmutableSet.copyOf(fNames);\n  }\n\n  @Override\n  public Type getFieldType(String fieldName) throws SemanticCheckFailure {\n    int fieldIndex = fieldNames.indexOf(fieldName);\n    if (fieldIndex != -1) {\n      return fieldTypes.get(fieldIndex);\n    } else {\n      if (!fieldName.startsWith(\"_\")) {\n        throw new SemanticCheckFailure(\n            String.format(\n                \"field name %s is not found in struct tuple class %s\",\n                fieldName,\n                toString()));\n      }\n\n      try {\n        return typeParams.get(Integer.valueOf(fieldName.substring(1)) - 1);\n      } catch (Throwable t) {\n        throw new SemanticCheckFailure(t);\n      }\n\n    }\n  }\n\n  @Override\n  public boolean isSetValue(StructTuple obj, String fieldName) {\n    if (fieldNames.contains(fieldName)) {","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/botmaker/src/java/com/twitter/botmaker/compiler/types/StructTupleType.java#L121-L157","documentation":"getFieldType on a StructTupleType resolves a field by name. Names not present in fieldNames and not starting with '_' (tuple positional syntax) are rejected with SemanticCheckFailure.","triggerScenarios":"Calling getFieldType(fieldName) with a name that is neither in the StructTuple's fieldNames list nor prefixed with '_' (e.g. a typo, a thrift field name used on a tuple class, or '_abc' style positional abuse reaching the non-numeric path).","commonSituations":"Rules written against thrift structs but executed on generated Tuple/StructTuple classes; field renames in the schema; copy-paste of field names with typos.","solutions":["Check fieldName against getFieldNames() (or use '_1', '_2' positional names) before calling getFieldType","Fix the typo or use the renamed field from the current schema","Confirm you are operating on the right class (tuple vs thrift struct)"],"exampleFix":"// before\ntype.getFieldType(\"usr_id\"); // typo\n// after\nSet<String> names = type.getFieldNames(); // inspect, then\ntype.getFieldType(\"user_id\");","handlingStrategy":"type-guard","validationCode":"boolean ok = tuple.getFieldNames().contains(name) || name.matches(\"_\\\\d+\"));","typeGuard":"boolean isValidTupleField(StructTupleType t, String name) {\n  return t.getFieldNames().contains(name) || name.matches(\"_\\\\d+\");\n}","tryCatchPattern":"catch SemanticCheckFailure and treat as a compile-time rule error; reject the rule with the offending name","preventionTips":["Auto-complete field names from getFieldNames() in rule editors","Lint rule fields against the deployed schema"],"tags":["struct-tuple","field-lookup","validation"],"backgroundTag":"unknown-field-name","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}