Environment
- Library: io.getstream:stream-chat-android-client
- Version: 5.17.23 (likely affects other versions with the same DTO)
- Integration: ChannelClient.watch() / channel query responses that include messages with image (or other) attachments
Problem
The HTTP API returns 200 and valid JSON, but the Android SDK reports failure with:
- ChatErrorCode.NETWORK_FAILED (stream code 1000)
- Message: Response is failed. See cause
- statusCode: -1
So the failure is client-side deserialization, not a failed HTTP call or empty messages.
Root cause (observed)
DownstreamMessageDto / AttachmentDto models file_size as a non-null Int (default 0). When the server JSON includes an attachment with an explicit null:
"attachments": [
{
"type": "image",
"image_url": "https://example.com/image.jpeg",
"file_size": null
}
]
Moshi fails to parse (JsonDataException: expected int, got null). That exception is wrapped as NETWORK_FAILED / 1000, which is misleading when debugging.
Expected behavior
The SDK should tolerate file_size: null the same way it tolerates a missing field—e.g. treat null as “unknown” and coerce to 0 or use Int? in AttachmentDto with safe mapping to domain models.
Environment
Problem
The HTTP API returns 200 and valid JSON, but the Android SDK reports failure with:
So the failure is client-side deserialization, not a failed HTTP call or empty messages.
Root cause (observed)
DownstreamMessageDto / AttachmentDto models file_size as a non-null Int (default 0). When the server JSON includes an attachment with an explicit null:
Moshi fails to parse (JsonDataException: expected int, got null). That exception is wrapped as NETWORK_FAILED / 1000, which is misleading when debugging.
Expected behavior
The SDK should tolerate file_size: null the same way it tolerates a missing field—e.g. treat null as “unknown” and coerce to 0 or use Int? in AttachmentDto with safe mapping to domain models.