Skip to content

[CLOSED] [Bug] Open-API Crashes on Truncated JSON from Android Clients #50

@dannyyaou

Description

@dannyyaou

Issue by rankaiyx
Sunday Aug 10, 2025 at 02:22 GMT
Originally opened as aws-samples#55


Describe the bug

The open-api seems to have a flaw: when it receives a truncated JSON (which frequently occurs when an Android client connects to an LLM inference engine on a high-speed local network), it immediately throws an error and terminates the chat.

I suspect this is a flaw in the file:
react-native/src/api/open-api.ts

Steps To Reproduce

Steps to reproduce the behavior:
Use mlc-llm to deploy a openai compatible llm engine.
Use the Android client in the same LAN to connect to it and chat.

This may be a more edge case, and it is not easy to reproduce the environment. I can help test it.

Expected behavior

No more errors.

App Version

2.4.0

React Native version

.

The platform of the bug

Android

Relevant log output

<details>
<summary>Log Messages</summary>
During streaming reception, the following appears at the end:
data: {"id":"chatcmpl-c435dcca209f4943b474e0bfbca0413f","choices":[{"finish_reason":null,"index":0,"delta":{"content":"hello","role":"assistant","name":null,"tool_calls":null,"tool_call_id":null},"logprobs":null}],"created":1754622244,"model":"q
-------------------- or -------------------
data: {"id":"chatcmpl-45cf0a3f0ee74983a4b3c2cf3bc2f368","choices":[{"finish_reason":null,"index":0,"delta":{"content":"","role":"assistant","name":null,"tool_calls":null,"tool_call_id":null},"logprobs":null}],"created":1754622149,"model":"qwen","

</details>

Is this a regression?

no

Regression additional context

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions