{"record":{"id":"982d70706075c428","repo":"xai-org/x-algorithm","slug":"tuples-are-not-supported-in-strato-json","errorCode":null,"errorMessage":"Tuples are not supported in strato JSON","messagePattern":"Tuples are not supported in strato JSON","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"botmaker/src/java/com/twitter/botmaker/compiler/Serializer.java","lineNumber":1374,"sourceCode":"      protected void toScript(GenScript script, Tuple tuple) throws Exception {\n        script.builder.append(\"Tuple(\");\n        script.level++;\n\n        for (int index = 0; index < tuple.size(); index++) {\n          if (index > 0) {\n            script.builder.append(\", \");\n          }\n          Object item = tuple.get(index);\n          typeParams[index].serializer.genScript(script, item);\n        }\n\n        script.level--;\n        script.builder.append(\")\");\n      }\n\n      @Override\n      protected void toStratoJson(GenScript script, Tuple tuple) {\n        throw new IllegalArgumentException(\"Tuples are not supported in strato JSON\");\n      }\n    };\n  }\n\n  public static Serializer<StructTuple> structTupleOf(\n      ImmutableList<String> fieldNames, ImmutableList<Type> fieldTypes) {\n    Preconditions.checkArgument(fieldNames.size() == fieldTypes.size());\n    return new Serializer<StructTuple>() {\n\n      @Override\n      public void computeFingerprint(Hasher hasher, StructTuple structTuple) throws Exception {\n\n        for (int index = 0; index < structTuple.size(); index++) {\n          hasher.putInt(index);\n          hasher.putUnencodedChars(fieldNames.get(index));\n          fieldTypes.get(index).computerFingerprint(hasher);\n          if (structTuple.get(index) != null) {\n            fieldTypes.get(index).serializer.computeFingerprint(hasher, structTuple.get(index));","sourceCodeStart":1356,"sourceCodeEnd":1392,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/botmaker/src/java/com/twitter/botmaker/compiler/Serializer.java#L1356-L1392","documentation":"The tuple serializer supports fingerprint generation (toScript writes parenthesized elements) but its toStratoJson override unconditionally throws IllegalArgumentException because the Tuple type has no strato JSON encoding. Any attempt to convert a Tuple value into strato JSON fails immediately.","triggerScenarios":"Creating a serializer via Serializer.tupleOf(typeParams...) and invoking genStratoJson on a Tuple value; typically when a rule/feature typed as a tuple is exported or served through the strato JSON path.","commonSituations":"Using tuple-typed constants or columns in botmaker features that are then registered for strato discovery; refactoring a struct into a tuple and forgetting the JSON path; enabling strato serving on an existing tuple-typed feature.","solutions":["Replace Tuple with StructTuple or a named thrift struct and serialize via thriftStructOf/structTupleOf if strato JSON support exists for that path.","Keep tuples only on the fingerprint/genScript path and exclude them from strato JSON export.","If strato JSON must carry the data, encode the tuple as a JSON array via a custom serializer branch (extend toStratoJson) instead of throwing."],"exampleFix":"// before\nSerializer<Tuple> t = Serializer.tupleOf(intOf(), stringOf());\nt.genStratoJson(script, tuple); // throws Tuples are not supported in strato JSON\n\n// after\nStructTuple st = StructTuple(ImmutableList.of(\"i\", \"s\"), ImmutableList.of(1, \"x\"));\nSerializer.structTupleOf(names, types).genStratoJson(script, st);","handlingStrategy":"validation","validationCode":"if (usesTuple(type)) {\n  throw new IllegalArgumentException(featureName + \" uses Tuple, not strato-JSON serializable\");\n}","typeGuard":null,"tryCatchPattern":"catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"Tuples are not supported\")) {\n    return fingerprintViaGenScript(tuple); // fallback path\n  }\n  throw e;\n}","preventionTips":["Ban tupleOf in types destined for strato serving; use structTupleOf or thrift structs.","Assert strato-JSON capability in feature-registration tests."],"tags":["strato-json","tuples","serialization","java"],"backgroundTag":"unsupported-type-for-strato-json","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}