Mintplex-Labs/anything-llm · warning
Maximum workspace memory limit (${this.WORKSPACE_LIMIT}) rea
Error message
Maximum workspace memory limit (${this.WORKSPACE_LIMIT}) reached. What it means
400 from POST /memories/:memoryId/demote/:slug. Demoting a global memory into the target workspace would exceed WORKSPACE_LIMIT (20 per user per workspace); demoteToWorkspace counts that workspace's memories for the user and refuses without writing.
Source
Thrown at server/endpoints/memory.js:186
"/memories/:memoryId/demote/:slug",
[
validatedRequest,
flexUserRoleValid([ROLES.all]),
memoryFeatureEnabled,
validateMemoryOwner,
validWorkspaceSlug,
],
async (request, response) => {
try {
const memoryId = Number(request.params.memoryId);
const targetWorkspace = response.locals.workspace;
const { memory, message } = await Memory.demoteToWorkspace(
memoryId,
targetWorkspace.id
);
if (!memory) return response.status(400).json({ error: message });
response.status(200).json({ memory });
} catch (e) {
console.error(e);
return response.sendStatus(500);
}
}
);
}
module.exports = { memoryEndpoints };
View on GitHub (pinned to 3aec848f28)
Solutions
- Delete or demote-out some memories in the target workspace first
- Keep the memory global if that workspace is full
- Raise Memory.WORKSPACE_LIMIT if the deployment needs a larger cap
Example fix
// before
await fetch(`/memories/${id}/demote/${slug}`, { method: 'POST' });
// after
const wsCount = memories.filter((m) => m.scope === 'workspace' && m.workspaceId === targetWs.id).length;
if (wsCount >= 20) { alert('Workspace memory limit (20) reached'); return; }
await fetch(`/memories/${id}/demote/${slug}`, { method: 'POST' }); Defensive patterns
Strategy: validation
Validate before calling
const wsCount = memories.filter((m) => m.scope === 'workspace' && m.workspaceId === targetWorkspace.id).length;
if (wsCount >= 20) throw new Error('Target workspace memory limit (20) reached — remove one first'); Prevention
- Check the target workspace's count (cap 20 per user) before offering Demote into it
- Bulk demote scripts should stop at the cap, not fire all moves
- The cap is per user per workspace — a full workspace for one user may be empty for another
When it happens
Trigger: POST /memories/:id/demote/:slug when the target workspace (resolved from :slug via validWorkspaceSlug) already holds 20 workspace-scoped memories for this user.
Common situations: Moving several global memories into an already-full workspace; bulk demote scripts ignoring per-workspace caps.
Related errors
- Maximum ${scope} memory limit (${limit}) reached.
- Maximum global memory limit (${this.GLOBAL_LIMIT}) reached.
- Content must be a non-empty string
- Memory is already workspace-scoped.
- Could not load ${this.model} into Foundry Local: ${error}
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/31ca46173bccca64.
Report an issue: GitHub.