Skip to content

ReferenceError in the chat error path makes every real error invisible #5599

Description

@Ninthkitten

Prerequisites

  • I searched open issues and discussions and did not find an existing report of this bug.
  • This is not a security vulnerability.
  • I am running the latest code from the dev branch.

Install Method

Docker

Operating System

macOS (Apple Silicon), Docker Desktop

Steps to Reproduce

  1. Make a chat request fail before streaming starts — e.g. point at a model the backend refuses to load.
  2. Watch the browser console and the chat window.

Expected Behaviour

The error handler shows the real error.

Actual Behaviour

static/js/chat.js declares streamingTTS inside the streaming block (~line 1414) but references it in the error path (~line 3253). Any failure that occurs before the streaming block reaches the catch with the name undefined, so the error handler itself throws:

ReferenceError: streamingTTS is not defined

The real error is never shown. The user sees an empty reply and unresponsive buttons — a silent failure that looks like the app hanging rather than an upstream error being reported.

This masked a model-refusal error here for days. It looks like "empty answers" or "dead buttons", so it sends you hunting in the wrong place entirely.

Logs / Screenshots

Uncaught (in promise) ReferenceError: streamingTTS is not defined
    at chat.js:3253

(the actual backend error appears one line above, then is lost)

Additional Information

Fix running here: a typeof guard on the reference in the error path, so the handler survives and renders the real error. One line.

Any error path that can throw is worse than no error path — it converts every upstream failure into a silent one.

Are you willing to submit a fix?

Yes — the fix described above is running in production here and I can open a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready for reviewDescription complete — ready for maintainer review

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions