{"record":{"id":"1b9777e6ac3f9ed3","repo":"xai-org/x-algorithm","slug":"field-s-does-not-belong-to-s","errorCode":null,"errorMessage":"Field %s does not belong to %s","messagePattern":"Field (.+?) does not belong to (.+?)","errorType":"validation","errorClass":"SemanticCheckFailure","httpStatus":null,"severity":"error","filePath":"botmaker/src/java/com/twitter/botmaker/compiler/CompilerUnit.java","lineNumber":284,"sourceCode":"      }\n\n      @Override\n      public ASTNode createASTNode(ImmutableList<ASTNode> children) throws SemanticCheckFailure {\n\n        ImmutableList<String> fieldNames = structTupleType.fieldNames;\n        ASTNode[] fieldValues = new ASTNode[fieldNames.size()];\n\n        for (ASTNode child : children) {\n          if (!(child instanceof ToPair)) {\n            throw new SemanticCheckFailure(\n                String.format(\n                    \"StructTuple expects pairs of name and values, but a %s received\", child)\n            );\n          }\n\n          String fieldName = ((Constant) child.getChildren().get(0)).getValue().toString();\n          if (!fieldNames.contains(fieldName)) {\n            throw new SemanticCheckFailure(\n                String.format(\"Field %s does not belong to %s\", fieldName, toString())\n            );\n          }\n          fieldValues[fieldNames.indexOf(fieldName)] = (ASTNode) child.getChildren().get(1);\n        }\n        return new ToStructTuple(fn, fieldNames, ImmutableList.copyOf(fieldValues)) {\n          @Override\n          public Signature getSignature() {\n            return signature;\n          }\n        };\n      }\n    });\n  }\n}\n","sourceCodeStart":266,"sourceCodeEnd":300,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/botmaker/src/java/com/twitter/botmaker/compiler/CompilerUnit.java#L266-L300","documentation":"A StructTuple field pair names a field that is not in the struct type's fieldNames list, so the value cannot be placed. This is the DSL equivalent of 'no such field' on a struct literal.","triggerScenarios":"Writing MyStruct(wrongField = x) where wrongField is not declared in the struct's schema; using an outdated field name after the thrift struct changed.","commonSituations":"Thrift schema evolution (renamed/removed fields) with stale expressions; typos in field names; copy-pasting literals between different struct types.","solutions":["Check the struct definition and correct the field name","Regenerate/refresh thrift/scrooge types if the schema changed recently","Use the correct struct type for the fields being set"],"exampleFix":"// before\nUser(nmae = \"bob\")\n// after\nUser(name = \"bob\")","handlingStrategy":"validation","validationCode":"if (!structTupleType.fieldNames.contains(fieldName)) throw new IllegalArgumentException(\"No such field: \" + fieldName);","typeGuard":"boolean isValidField(StructTupleType t, String f) { return t.fieldNames.contains(f); }","tryCatchPattern":"catch (SemanticCheckFailure e) { /* compare against current schema field list */ }","preventionTips":["Regenerate thrift/scrooge types after schema changes","Validate field names against the generated struct before compiling"],"tags":["botmaker","struct","field","schema-mismatch"],"backgroundTag":"unknown-struct-field","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}