bytedance/deer-flow · error

Request failed.

Error message

Request failed.

What it means

Generic wrapper for a failed POST to /api/threads/{threadId}/runs/regenerate/prepare in the regenerate flow. When the response is not ok, readResponseErrorMessage extracts the body's error detail; the literal 'Request failed.' is that helper's default when the body carries no parseable detail.

Source

Thrown at frontend/src/core/threads/hooks.ts:2419

      }
      return submitPreparedReplay({
        threadId,
        prepare: async () => {
          const response = await fetch(
            `${getBackendBaseURL()}/api/threads/${encodeURIComponent(
              threadId,
            )}/runs/regenerate/prepare`,
            {
              method: "POST",
              headers: {
                "Content-Type": "application/json",
              },
              credentials: "include",
              body: JSON.stringify({ message_id: messageId }),
            },
          );
          if (!response.ok) {
            throw new Error(await readResponseErrorMessage(response));
          }
          return (await response.json()) as RegeneratePrepareResponse;
        },
        getSupersededMessageIds: () => supersededMessageIds,
      });
    },
    [submitPreparedReplay],
  );

  const editAndRegenerateMessage = useCallback(
    async (
      threadId: string,
      humanMessageId: string,
      replacementText: string,
    ) => {
      if (!humanMessageId) {
        return false;
      }

View on GitHub (pinned to 1dd6ba1acb)

Solutions

  1. Check the Network tab for the regenerate/prepare request: the HTTP status and body pinpoint the cause (404 gone, 401 auth, 500 server).
  2. If 401/403, re-authenticate and retry the regeneration from the UI.
  3. If 404/410, the run state is gone server-side — reload the thread; regenerate may be unavailable for that message.
  4. If 500, inspect gateway logs at the timestamp of the request for the prepare-handler traceback.

Example fix

// before: opaque error
throw new Error(await readResponseErrorMessage(response));

// after: include status for diagnosability
const detail = await readResponseErrorMessage(response);
throw new Error(`Regenerate prepare failed (${response.status}): ${detail}`);
Defensive patterns

Strategy: try-catch

Validate before calling

// Nothing client-side can fully pre-validate a server prepare step; verify the thread/run still exist first if a cheap read endpoint is available.

Try / catch

try { await regenerateMessage(threadId, messageId); } catch (e) { if (/Request failed/.test(e.message)) { const status = lastRegenerateStatus(); if (status === 401) { await relogin(); } else { toast('Regeneration unavailable — reload the thread.'); } return; } throw e; }

Prevention

When it happens

Trigger: Regenerating a message whose thread/run no longer exists on the server (404), a gateway 500 while preparing the replay state, auth/cookie expiry returning 401/403, or an nginx route miss returning a non-JSON error page so the detail cannot be extracted.

Common situations: Session cookie expired while the tab sat open, gateway restarted and lost in-memory run state, regenerating from an old thread after the server data was pruned.

Related errors


AI-assisted analysis of bytedance/deer-flow@1dd6ba1acb (2026-08-14). Data as JSON: /api/errors/43933f912b496593. Report an issue: GitHub.