Mintplex-Labs/anything-llm · warning
Not Found
Error message
Not Found
What it means
DELETE /admin/workspaces/:id (server/endpoints/admin.js:295) returns HTTP 404 via response.sendStatus(404).end() at line 308 when Workspace.get({ id: Number(id) }) returns a falsy workspace. This is an explicit, intentional guard — not an exception — fired when the workspace row for the given id does not exist.
Source
Thrown at server/endpoints/admin.js:308
response.sendStatus(500).end();
}
}
);
app.delete(
"/admin/workspaces/:id",
[
validatedRequest,
strictMultiUserRoleValid([ROLES.admin, ROLES.manager]),
workspaceDeletionProtection,
],
async (request, response) => {
try {
const { id } = request.params;
const VectorDb = getVectorDbClass();
const workspace = await Workspace.get({ id: Number(id) });
if (!workspace) {
response.sendStatus(404).end();
return;
}
await WorkspaceChats.delete({ workspaceId: Number(workspace.id) });
await DocumentVectors.deleteForWorkspace(Number(workspace.id));
await Document.delete({ workspaceId: Number(workspace.id) });
await Workspace.delete({ id: Number(workspace.id) });
try {
await VectorDb["delete-namespace"]({ namespace: workspace.slug });
} catch (e) {
console.error(e.message);
}
response.status(200).json({ success: true, error: null });
} catch (e) {
console.error(e);
response.sendStatus(500).end();
}View on GitHub (pinned to 526360e320)
Solutions
- Treat 404 as success if the user's intent was 'make sure it's gone' (idempotent delete).
- Refresh the workspace list in the UI before issuing the delete to avoid stale ids.
- If the front-end shows an error toast on 404, suppress it specifically for delete operations.
- Confirm :id is the numeric primary key and not the workspace slug — the lookup uses id, not slug.
Defensive patterns
Strategy: validation
Validate before calling
const ws = await Workspace.get({ id: Number(id) });
if (!ws) {
// expected when caller asks to delete something already gone
return response.sendStatus(404).end();
} Prevention
- Treat 404 on delete as idempotent success when the goal is 'ensure it is gone'.
- Refresh the workspace list in the UI before deleting to avoid stale ids.
- Suppress 404 error toasts in the client for delete operations specifically.
When it happens
Trigger: DELETE /admin/workspaces/999 where workspace 999 does not exist; the workspace was already deleted in another session; :id is a numeric-looking string that Number() coerces to a value with no matching row (including NaN, since Number('abc')=NaN and no workspace has id NaN).
Common situations: Stale admin UI still showing a workspace tile that has been removed; double-click on the delete button causing the second request to find nothing; an automated cleanup script running concurrently.
Related errors
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/f7d62acd6165bf29.
Report an issue: GitHub.