langflow-ai/langflow · error · Error

Error in streaming request.

Error message

Error in streaming request.

What it means

Thrown by performStreamingRequest in controllers/API when the fetch for a streaming endpoint returns a non-OK response and no onError callback was supplied. The helper delegates status handling to onError; without it, all it can do is raise this generic error, and the stream is never read.

Solutions

  1. Pass an onError callback so callers receive the real status code instead of a generic throw
  2. Check devtools for the actual status of the failing stream request and fix the underlying cause (auth, 404, 500)
  3. If 401/403, refresh the session and retry once
  4. Verify the URL and payload shape match the current backend version after upgrades

Example fix

// before
await performStreamingRequest({ method: "POST", url, body });

// after
await performStreamingRequest({
  method: "POST",
  url,
  body,
  onError: (status) => {
    if (status === 401) refreshSession();
    else setStreamError(`Stream failed with ${status}`);
  },
});
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await performStreamingRequest({ method, url, body, onError: (status) => {
    streamErrors.push(status); // always pass onError; the generic throw is the no-onError fallback
  }});
} catch (e) {
  if (e instanceof Error && e.message === "Error in streaming request.") {
    // no onError was wired; add one to learn the real status
  } else throw e;
}

Prevention

When it happens

Trigger: Calling performStreamingRequest({url, ...}) where url returns 4xx/5xx and the options object omits onError — e.g. an SSE/build/chat endpoint returning 401 after token expiry or 404 for a missing resource.

Common situations: New call sites forgetting the onError parameter; expired sessions hitting stream endpoints; endpoints returning 404 after a route rename in a newer backend.

Related errors


AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14). Data as JSON: /api/errors/017d7fd548976d77. Report an issue: GitHub.

Appendix: source

Thrown at src/frontend/src/controllers/API/api.tsx:347

  const params: RequestInit = {
    method: method,
    headers: headers,
    signal: buildController.signal,
    credentials: getFetchCredentials(),
  };
  if (body) {
    params.body = JSON.stringify(body);
  }
  let current: string[] = [];
  const textDecoder = new TextDecoder();

  try {
    const response = await fetch(url, params);
    if (!response.ok) {
      if (onError) {
        onError(response.status);
      } else {
        throw new Error("Error in streaming request.");
      }
    }
    if (response.body === null) {
      return;
    }
    const reader = response.body.getReader();
    while (true) {
      const { done, value } = await reader.read();
      if (done) {
        break;
      }
      const decodedChunk = textDecoder.decode(value);
      const all = decodedChunk.split("\n\n");

      // Parse all complete events from this chunk first
      const parsedEvents: object[] = [];
      for (const string of all) {
        if (string.endsWith("}")) {

View on GitHub (pinned to 976ec789d2)