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
- Check the DELETE status: treat 404 as success when the goal is removal (idempotent delete).
- 401: re-auth and retry.
- 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
- Treat 404 on delete as success (idempotent semantics) at the call site or in the api wrapper.
- Optimistically remove the row and roll back only on non-404 failure.
- Refresh the file list after any delete attempt to resync multi-tab state.
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
- Failed to delete local thread data.
- Upload failed
- Failed to load upload limits
- Failed to list uploaded files
- File not found: {filename}
AI-assisted analysis of bytedance/deer-flow@1dd6ba1acb (2026-08-14).
Data as JSON: /api/errors/c3c3290a01a38604.
Report an issue: GitHub.