Mintplex-Labs/anything-llm · warning

Maximum global memory limit (${this.GLOBAL_LIMIT}) reached.

Error message

Maximum global memory limit (${this.GLOBAL_LIMIT}) reached.

What it means

400 from POST /memories/:memoryId/promote. Promoting a workspace memory would exceed the per-user global cap of 5 (Memory.GLOBAL_LIMIT); promoteToGlobal counts the user's existing global memories and refuses without modifying the row.

Source

Thrown at server/endpoints/memory.js:157

        console.error(e);
        return response.sendStatus(500);
      }
    }
  );

  app.post(
    "/memories/:memoryId/promote",
    [
      validatedRequest,
      flexUserRoleValid([ROLES.all]),
      memoryFeatureEnabled,
      validateMemoryOwner,
    ],
    async (request, response) => {
      try {
        const memoryId = Number(request.params.memoryId);
        const { memory, message } = await Memory.promoteToGlobal(memoryId);
        if (!memory) return response.status(400).json({ error: message });

        response.status(200).json({ memory });
      } catch (e) {
        console.error(e);
        return response.sendStatus(500);
      }
    }
  );

  app.post(
    "/memories/:memoryId/demote/:slug",
    [
      validatedRequest,
      flexUserRoleValid([ROLES.all]),
      memoryFeatureEnabled,
      validateMemoryOwner,
      validWorkspaceSlug,
    ],

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Demote or delete a global memory to free a slot, then promote again
  2. Keep the memory workspace-scoped if it does not need cross-workspace effect
  3. Raise Memory.GLOBAL_LIMIT in server/models/memory.js if the deployment genuinely needs more

Example fix

// before
await fetch(`/memories/${id}/promote`, { method: 'POST' });
// after
const globals = memories.filter((m) => m.scope === 'global');
if (globals.length >= 5) { alert('Global memory limit (5) reached — demote one first'); return; }
await fetch(`/memories/${id}/promote`, { method: 'POST' });
Defensive patterns

Strategy: validation

Validate before calling

const globalCount = memories.filter((m) => m.scope === 'global').length;
if (globalCount >= 5) throw new Error('Global memory limit (5) reached — demote or delete one first');

Prevention

When it happens

Trigger: POST /memories/:id/promote when the owning user already has 5 global-scoped memories (userId-scoped count, null in single-user mode).

Common situations: Consolidating many workspace memories upward; forgetting the global cap (5) is much tighter than the workspace cap (20).

Related errors


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