slackapi / slackapi/java-slack-sdk
Slack API issues with deserializing api payloads
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 602
- Forks
- 232
- Avg merge
- 4d 9h
- Merged PRs (30d)
- 7
Description
For one of our customers, we hit this deserialization issue with 1.45.2 of the sdk.
Got an exception while calling conversations.history API (team: ****, error: java.lang.IllegalStateException: Not a JSON Object: [])
j.l.IllegalStateException: Not a JSON Object: []
at c.g.gson.JsonElement.getAsJsonObject(JsonElement.java:165)
at c.s.a.u.j.GsonFileFactory.deserialize(GsonFileFactory.java:46)
at c.s.a.u.j.GsonFileFactory.deserialize(GsonFileFactory.java:8)
at c.g.g.i.b.TreeTypeAdapter.read(TreeTypeAdapter.java:95)
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)
... 40 common frames omitted
Wrapped by: c.g.g.JsonSyntaxException: java.lang.IllegalStateException: Not a JSON Object: []
at c.g.g.i.b.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:520)
at c.google.gson.Gson.fromJson(Gson.java:1361)
at c.google.gson.Gson.fromJson(Gson.java:1463)
at c.google.gson.Gson.fromJson(Gson.java:1434)
at c.g.g.i.b.TreeTypeAdapter$GsonContextImpl.deserialize(TreeTypeAdapter.java:199)
at c.s.a.u.j.GsonLayoutBlockFactory.deserialize(GsonLayoutBlockFactory.java:31)
at c.s.a.u.j.GsonLayoutBlockFactory.deserialize(GsonLayoutBlockFactory.java:12)
at c.g.g.i.b.TreeTypeAdapter.read(TreeTypeAdapter.java:95)
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:...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with GsonFileFactory.java at deserialize, then inspect GsonLayoutBlockFactory.java and the conversations.history payload involved in the stack trace. Reproduce the reported response and determine why an array reaches code expecting a JSON object; done means the payload deserializes without the reported exception and the relevant test coverage passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100