{"record":{"id":"05334c58631abaed","repo":"Mintplex-Labs/anything-llm","slug":"cannot-create-a-preset-with-a-command-that-matches","errorCode":null,"errorMessage":"Cannot create a preset with a command that matches a system command","messagePattern":"Cannot create a preset with a command that matches a system command","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"server/endpoints/system.js","lineNumber":1314,"sourceCode":"        console.error(\"Error fetching slash command presets:\", error);\n        response.status(500).json({ message: \"Internal server error\" });\n      }\n    }\n  );\n\n  app.post(\n    \"/system/slash-command-presets\",\n    [validatedRequest, flexUserRoleValid([ROLES.all])],\n    async (request, response) => {\n      try {\n        const user = await userFromSession(request, response);\n        const { command, prompt, description } = reqBody(request);\n        const formattedCommand = SlashCommandPresets.formatCommand(\n          String(command)\n        );\n\n        if (isReservedCommand(formattedCommand)) {\n          return response.status(400).json({\n            message:\n              \"Cannot create a preset with a command that matches a system command\",\n          });\n        }\n\n        const presetData = {\n          command: formattedCommand,\n          prompt: String(prompt),\n          description: String(description),\n        };\n\n        const preset = await SlashCommandPresets.create(user?.id, presetData);\n        if (!preset) {\n          return response\n            .status(500)\n            .json({ message: \"Failed to create preset\" });\n        }\n        response.status(201).json({ preset });","sourceCodeStart":1296,"sourceCodeEnd":1332,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/20f6d3546c1938bfea1ad304f58a592dddcc5948/server/endpoints/system.js#L1296-L1332","documentation":"Server-side validation error in POST /api/system (system.js): 'Cannot create a preset with a command that matches a system command'. When creating a preset, the requested preset command/trigger collides with a built-in system command. The server checks the proposed command against its registry of reserved system commands and rejects the request to prevent the preset from shadowing or hijacking core system functionality.","triggerScenarios":"Thrown at server/endpoints/system.js:1300 when the library encounters an invalid state.","commonSituations":"Creating a slash-command preset whose command matches a reserved system command.","solutions":["Choose a preset command that does not collide with a built-in system command.","Prefix custom commands to avoid system names."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"20f6d3546c1938bfea1ad304f58a592dddcc5948","analyzedAt":"2026-09-01T05:04:15.951Z","contentChangedAt":"2026-09-01T05:04:15.951Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}