Mintplex-Labs/anything-llm · info
Memory is already workspace-scoped.
Error message
Memory is already workspace-scoped.
What it means
Idempotency message from Memory.demoteToWorkspace when the memory's scope is already 'workspace'. The model returns {memory: existing, message}, and the endpoint only 400s on memory:null — so the HTTP response is actually 200 with the memory; this message appears only in logs/tests, never as an error body.
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
- Nothing to fix — the request succeeds (200) and returns the memory
- Hide/disable Demote when the loaded memory has scope 'workspace'
- Safe to ignore in automation; idempotent by design
Example fix
// before if (memory) showDemoteButton(); // after if (memory && memory.scope !== 'workspace') showDemoteButton();
Defensive patterns
Strategy: type-guard
Type guard
function isDemotable(memory) {
return memory !== null && memory.scope === 'global'; // only global memories can demote
} Prevention
- Only render Demote for memories with scope 'global'
- Sync local state from mutation responses so actions never go stale
- Know this path is idempotent — endpoint returns 200 with the memory, not 400
When it happens
Trigger: POST /memories/:id/demote/:slug on a memory already scoped to a workspace — double-submit of Demote or a stale UI.
Common situations: Demote button clicked twice; another client demoted the same memory first; retry of an already-succeeded demote.
Related errors
- Memory is already global.
- Maximum workspace memory limit (${this.WORKSPACE_LIMIT}) rea
- Could not load ${this.model} into Foundry Local: ${error}
- Personalization is disabled.
- Memory not found.
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/7b750ded682e2322.
Report an issue: GitHub.