Skip to content

Requesting a single thread throws JsonEncodingException #248

Closed

Description

@flokle

I have tried to fetch a single thread via the sdk. The following error is thrown:

com.squareup.moshi.JsonEncodingException: Use JsonReader.setLenient(true) to accept malformed JSON at path $
	at com.squareup.moshi.JsonReader.syntaxError(JsonReader.java:243)
	at com.squareup.moshi.JsonUtf8Reader.checkLenient(JsonUtf8Reader.java:1154)
	at com.squareup.moshi.JsonUtf8Reader.doPeek(JsonUtf8Reader.java:386)
	at com.squareup.moshi.JsonUtf8Reader.peek(JsonUtf8Reader.java:208)
	at com.squareup.moshi.internal.NullSafeJsonAdapter.fromJson(NullSafeJsonAdapter.java:38)
	at com.squareup.moshi.JsonAdapter.fromJson(JsonAdapter.java:58)
	at com.nylas.NylasClient.executeRequest(NylasClient.kt:330)
	at com.nylas.NylasClient.executeGet(NylasClient.kt:175)
	at com.nylas.resources.Resource.findResource(Resource.kt:27)
	at com.nylas.resources.Resource.findResource$default(Resource.kt:26)
	at com.nylas.resources.Threads.find(Threads.kt:33)
	at com.nylas.resources.Threads.find$default(Threads.kt:31)
	at com.nylas.resources.Threads.find(Threads.kt)

So i fetched the same thread via Postman and got this result:

Status code: 404
Body:
{
    "request_id": "...",
    "error": {
        "type": "not_found_error",
        "message": "no messages found in this thread"
    }
}

What makes me wonder is that I have seen this error message in a NylasApiError exception before. I wonder why this JsonEncodingException is thrown here.

Expected behavior
There is always the same behavior in such a case - A NylasApiError is thrown with the message: "no messages found in this thread"

SDK Version:
2.5.0

Activity

  1. self-assigned this
    on Mar 4, 2025
  2. googsvg commented on May 7, 2026

    @googsvg
    Contributor

    Fixed by PR #318

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions