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

  1. Nothing to fix — the request succeeds (200) and returns the memory
  2. Hide/disable Demote when the loaded memory has scope 'workspace'
  3. 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

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


AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18). Data as JSON: /api/errors/7b750ded682e2322. Report an issue: GitHub.