bytedance/deer-flow · warning

Failed to delete file

Error message

Failed to delete file

What it means

deleteUploadedFile issues DELETE /api/threads/{threadId}/uploads/{encodedFilename} and throws on non-ok responses, preferring the gateway's detail (e.g. 'file not found') over this fallback.

Source

Thrown at frontend/src/core/uploads/api.ts:128

}

/**
 * Delete an uploaded file
 */
export async function deleteUploadedFile(
  threadId: string,
  filename: string,
): Promise<{ success: boolean; message: string }> {
  const encodedFilename = encodeURIComponent(filename);
  const response = await fetch(
    `${getBackendBaseURL()}/api/threads/${threadId}/uploads/${encodedFilename}`,
    {
      method: "DELETE",
    },
  );

  if (!response.ok) {
    throw new Error(await readErrorDetail(response, "Failed to delete file"));
  }

  return response.json();
}

View on GitHub (pinned to 1dd6ba1acb)

Solutions

  1. Check the DELETE status: treat 404 as success when the goal is removal (idempotent delete).
  2. 401: re-auth and retry.
  3. 5xx: verify storage health in gateway logs, then refresh the file list.

Example fix

// before: 404 after a race surfaces as an error
await deleteUploadedFile(threadId, filename);

// after: tolerate already-deleted
const res = await fetch(url, { method: 'DELETE' });
if (!res.ok && res.status !== 404) { throw new Error(await readErrorDetail(res, 'Failed to delete file')); }
Defensive patterns

Strategy: fallback

Try / catch

try { await deleteUploadedFile(threadId, filename); } catch (e) { if (isNotFound(e)) { /* already gone: refresh list, treat as done */ } else { toast(e.message || 'Failed to delete file'); } }

Prevention

When it happens

Trigger: Deleting a file already removed server-side (404 after a race with another tab), deleting on a deleted thread (404), expired session (401), or storage backend failure (5xx).

Common situations: Two tabs both showing an attachments list; deleting in one makes the other's delete 404. Also cleanup retries after a partially failed upload.

Related errors


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