xai-org/x-algorithm · error · IllegalArgumentException

Symbols are not supported in strato JSON

Error message

Symbols are not supported in strato JSON

What it means

The Symbol serializer intentionally does not support strato JSON serialization: toStratoJson for Symbol values throws IllegalArgumentException. Strato JSON has no representation for Symbol-typed data, so attempting to serialize one is a programming/config error rather than a data-size or formatting issue.

Source

Thrown at botmaker/src/java/com/twitter/botmaker/compiler/Serializer.java:258

      prot.writeString(value.getValue());
    }

    @Override
    protected Symbol deserialize(TProtocol prot) throws TException {
      return new Symbol(prot.readString());
    }

    @Override
    protected void toScript(GenScript script, Symbol value) {
      script.builder
          .append("`")
          .append(value.getValue())
          .append("`");
    }

    @Override
    protected void toStratoJson(GenScript script, Symbol value) {
      throw new IllegalArgumentException("Symbols are not supported in strato JSON");
    }
  };

  public static final Serializer<Long> LONG = new Serializer<Long>() {

    @Override
    public void computeFingerprint(Hasher hasher, Long value) {
      hasher.putLong(value);
    }

    @Override
    protected void serialize(TProtocol prot, Long value) throws TException {
      prot.writeI64(value);
    }

    @Override
    protected Long deserialize(TProtocol prot) throws TException {
      return prot.readI64();

View on GitHub (pinned to 24c60942c5)

Solutions

  1. Resolve/convert the Symbol to a supported primitive (e.g. its string name or extracted value) before strato serialization
  2. Use a different serialization target for Symbol-containing data (the binary/thrift path handles more types)
  3. If the Symbol should never reach this point, fix the upstream evaluation so symbols are substituted out first

Example fix

// before
serializer.toStratoJson(sb, symbolValue); // throws

// after
serializer.toStratoJson(sb, symbolValue.getName()); // or resolve symbol first
Defensive patterns

Strategy: type-guard

Validate before calling

// Resolve or reject Symbols before strato JSON serialization
Object v = (value instanceof Symbol) ? ((Symbol) value).getName() : value;

Type guard

boolean isStratoJsonSerializable(Object v) {
  return !(v instanceof Symbol);
}

Try / catch

try {
  serializer.toStratoJson(sb, value);
} catch (IllegalArgumentException e) {
  // fall back to string form or another serialization target
}

Prevention

When it happens

Trigger: Calling the serialization path that routes through toStratoJson on a value that is a Symbol instance — e.g. serializing a rule/struct containing a Symbol field to strato JSON format.

Common situations: Adding a Symbol field to a struct/rule that is also emitted as strato JSON; feeding a pipeline output intended for strato storage with expression symbols still unresolved.

Related errors


AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28). Data as JSON: /api/errors/d9da39874248f419. Report an issue: GitHub.