{"record":{"id":"b193216add04f2e2","repo":"Mintplex-Labs/anything-llm","slug":"memory-is-already-global","errorCode":null,"errorMessage":"Memory is already global.","messagePattern":"Memory is already global\\.","errorType":"http","errorClass":null,"httpStatus":400,"severity":"info","filePath":"server/endpoints/memory.js","lineNumber":157,"sourceCode":"        console.error(e);\n        return response.sendStatus(500);\n      }\n    }\n  );\n\n  app.post(\n    \"/memories/:memoryId/promote\",\n    [\n      validatedRequest,\n      flexUserRoleValid([ROLES.all]),\n      memoryFeatureEnabled,\n      validateMemoryOwner,\n    ],\n    async (request, response) => {\n      try {\n        const memoryId = Number(request.params.memoryId);\n        const { memory, message } = await Memory.promoteToGlobal(memoryId);\n        if (!memory) return response.status(400).json({ error: message });\n\n        response.status(200).json({ memory });\n      } catch (e) {\n        console.error(e);\n        return response.sendStatus(500);\n      }\n    }\n  );\n\n  app.post(\n    \"/memories/:memoryId/demote/:slug\",\n    [\n      validatedRequest,\n      flexUserRoleValid([ROLES.all]),\n      memoryFeatureEnabled,\n      validateMemoryOwner,\n      validWorkspaceSlug,\n    ],","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/endpoints/memory.js#L139-L175","documentation":"Idempotency message from Memory.promoteToGlobal when the memory's scope is already 'global'. The model returns {memory: existing, message}, and the endpoint only returns 400 when memory is null — so this message is effectively informational: the endpoint actually responds 200 with the memory. You will encounter it in logs/tests, not as an HTTP error body.","triggerScenarios":"POST /memories/:id/promote on a memory whose scope is already 'global' — typically a double-submit or a stale UI still showing a 'Promote' action.","commonSituations":"Promote button double-clicked; another client promoted the same memory moments earlier; retrying a promote that already succeeded.","solutions":["Nothing to fix — the request succeeds (200) and returns the current memory","Hide/disable the Promote action when the loaded memory already has scope 'global'","Safe to ignore in automation; the operation is idempotent"],"exampleFix":"// before\nif (memory) showPromoteButton();\n// after\nif (memory && memory.scope !== 'global') showPromoteButton();","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"function isPromotable(memory) {\n  return memory !== null && memory.scope === 'workspace'; // only workspace memories can promote\n}","tryCatchPattern":null,"preventionTips":["Only render Promote for memories with scope 'workspace'","Update local state from the response after any mutation so actions reflect reality","Know this path is idempotent — the endpoint returns 200 with the memory, not 400"],"tags":["memory","idempotent","promote"],"backgroundTag":"idempotent-no-op","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}