Deserialization issue with slack sdk with message attachments
Noticed this with one of our customers:
j.l.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 265032 path $.messages[115].attachments[0].list_records[0].fields[1].message See https://github.com/google/gson/blob/main/Troubleshooting.md#unexpected-json-structure at c.g.g.s.JsonReader.unexpectedTokenError(JsonReader.java:1768) at c.g.g.s.JsonReader.beginObject(JsonReader.java:469) at c.g.g.i.b.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:509) ... 43 common frames omitted Wrapped by: c.g.g.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 265032 path $.messages[115].attachments[0].list_records[0].fields[1].message See https://github.com/google/gson/blob/main/Troubleshooting.md#unexpected-json-structure at c.g.g.i.b.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:520) at c.g.g.Gson$FutureTypeAdapter.read(Gson.java:1516) at c.g.g.i.b.ReflectiveTypeAdapterFactory$2.readIntoField(ReflectiveTypeAdapterFactory.java:267) at c.g.g.i.b.ReflectiveTypeAdapterFactory$FieldReflectionAdapter.readField(ReflectiveTypeAdapterFactory.java:558) at c.g.g.i.b.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:516) at c.g.g.i.b.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40) at c.g.g.i.b.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:83) at c.g.g.i.b.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:59) at c.g.g.i.b.ReflectiveTypeAdapterFactory$2.readIntoField(ReflectiveTypeAdapterFactory.java:267) at c.g.g.i.b.ReflectiveTypeAdapterFactory$FieldReflectionAdapter.readField(ReflectiveTypeAdapterFactory.java:558) at c.g.g.i.b.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:516) at c.g.g.i.b.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40) at c.g.g.i.b.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:83)
👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out. If you think this issue needs to be prioritized, please comment to get the thread going again! Maintainers also review issues marked as stale on a regular basis and comment or adjust status if the issue needs to be reprioritized.
We're hitting this across a few of our customers...
Hey @rasharab! 👋 Apologies for lagging on a response here! 😓
At the moment it's not obvious what might be causing this, but I'm wondering if a specific message might be resulting in this that could be used for testing a fix?
A parsing error doesn't seem right for incoming events so I marked this as a "bug" but I also don't have a workaround 🐛
🔍 This might be related to https://github.com/slackapi/java-slack-sdk/issues/1468 but that seems to raise a different error due to the size of integers and not unexpected objects...
🔍 I'm linking the same and a few other related issues for reference with similar exceptions shared before:
- https://github.com/slackapi/java-slack-sdk/issues/1426
- https://github.com/slackapi/java-slack-sdk/issues/1468
- https://github.com/slackapi/java-slack-sdk/issues/1450
- https://github.com/slackapi/java-slack-sdk/issues/1454
Edit: Added another issue!
It would be nice if we could configure serialization such that it does not deserialize beyond a certain nested depth.
Our company doesn't really care about message attachments for example.
we are seeing the same errors