Skip to content

fallbackStream: skip edit when accumulated text is empty (Telegram VALIDATION_ERROR) #276

@kwhandy

Description

@kwhandy

Bug Description

When using fallbackStreamingPlaceholderText (non-null), the fallback streaming
timer fires before the LLM produces any text output. The SDK then attempts to edit
the placeholder message with an empty accumulated string, which Telegram (and likely
other platforms) reject with a VALIDATION_ERROR.

The errors are non-fatal (caught internally) and the final message delivers correctly.
But users are forced to choose between:

  • fallbackStreamingPlaceholderText: null — no visual indicator while LLM warms up / runs tool calls
  • fallbackStreamingPlaceholderText: "..." — visual indicator but repeated VALIDATION_ERROR log noise

Steps to Reproduce

  1. Configure a Telegram adapter with any non-null fallbackStreamingPlaceholderText
  2. Send a message that triggers LLM streaming
  3. Observe repeated VALIDATION_ERROR: Message text cannot be empty in logs during LLM warm-up or tool-calling phase

Expected Behavior

The SDK should skip the edit when accumulated text is empty — the placeholder ("...") remains displayed until the first real text chunk arrives, with no error.

Actual Behavior

Repeated log spam for every timer tick before the first text chunk arrives:

[chat-sdk] fallbackStream edit failed Error [ValidationError]: Message text cannot be empty
    at ignore-listed frames {
  adapter: 'telegram',
  code: 'VALIDATION_ERROR'
}

### Code Sample

```typescript

Chat SDK Version

4.20.2

Node.js Version

22.20.0

Platform Adapter

Other

Operating System

Linux

Additional Context

related to: #140

Metadata

Metadata

Assignees

No one assigned

    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