{"record":{"id":"eca4d8c61f36395d","repo":"Mintplex-Labs/anything-llm","slug":"personalization-is-disabled","errorCode":null,"errorMessage":"Personalization is disabled.","messagePattern":"Personalization is disabled\\.","errorType":"http","errorClass":null,"httpStatus":403,"severity":"warning","filePath":"server/endpoints/memory.js","lineNumber":14,"sourceCode":"const { Memory } = require(\"../models/memory\");\nconst { SystemSettings } = require(\"../models/systemSettings\");\nconst { userFromSession, reqBody } = require(\"../utils/http\");\nconst { validatedRequest } = require(\"../utils/middleware/validatedRequest\");\nconst {\n  flexUserRoleValid,\n  ROLES,\n} = require(\"../utils/middleware/multiUserProtected\");\nconst { validWorkspaceSlug } = require(\"../utils/middleware/validWorkspace\");\n\nasync function memoryFeatureEnabled(_req, response, next) {\n  const enabled = await SystemSettings.memoriesEnabled();\n  if (!enabled)\n    return response.status(403).json({ error: \"Personalization is disabled.\" });\n  next();\n}\n\n/**\n * Loads the memory by :memoryId and, in multi-user mode, scopes the query to the requester's userId.\n * A memory owned by another user returns null here and is indistinguishable from \"not found\" — 404 either way.\n */\nasync function validateMemoryOwner(request, response, next) {\n  try {\n    const clause = { id: Number(request.params.memoryId) };\n    if (response.locals.multiUserMode) {\n      const user = await userFromSession(request, response);\n      clause.userId = user?.id ?? null;\n    }\n\n    const memory = await Memory.get(clause);\n    if (!memory)\n      return response.status(404).json({ error: \"Memory not found.\" });","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/endpoints/memory.js#L1-L32","documentation":"403 from the memoryFeatureEnabled middleware guarding every /memories route. SystemSettings.memoriesEnabled() returned false — the Personalization feature flag is off — so the request is refused before any handler runs. Not a bug: an intentional disabled-feature gate.","triggerScenarios":"Any GET/POST/PUT/DELETE on /memories* with a valid session and role while the Personalization/memory toggle in System Settings is disabled.","commonSituations":"Fresh install with personalization off by default; admin disabled the feature to control LLM token spend; the flag silently reset after a settings migration or reset flow.","solutions":["Enable Personalization (memories) in System Settings as admin","If it should already be on, inspect the system_settings persistence to confirm the flag survived the last save","Have clients treat 403 + this message as a feature state, showing a 'Personalization is disabled' UI instead of an error toast","Re-issue the memory request after enabling"],"exampleFix":"// before\nconst res = await fetch('/memories');\n// after\nconst res = await fetch('/memories');\nif (res.status === 403) { showBanner('Personalization is disabled in settings'); return; }","handlingStrategy":"validation","validationCode":"// One-time capability probe; cache the result\nasync function memoriesAvailable() {\n  const r = await fetch('/memories');\n  if (r.status === 403) return false; // Personalization is disabled.\n  if (!r.ok) throw new Error('memories probe failed: ' + r.status);\n  return true;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Probe once at UI load and hide memory features when the flag is off","Cache the 403 result per session to avoid repeated refusals","Admins: enable Personalization in System Settings before building memory features on it"],"tags":["memory","feature-flag","middleware","http-403"],"backgroundTag":"feature-flag-disabled","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}