{"record":{"id":"f69ce1e1b10f023c","repo":"Mintplex-Labs/anything-llm","slug":"failed-to-create-preset","errorCode":null,"errorMessage":"Failed to create preset","messagePattern":"Failed to create preset","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/endpoints/system.js","lineNumber":1329,"sourceCode":"        );\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 });\n      } catch (error) {\n        console.error(\"Error creating slash command preset:\", error);\n        response.status(500).json({ message: \"Internal server error\" });\n      }\n    }\n  );\n\n  app.post(\n    \"/system/slash-command-presets/:slashCommandId\",\n    [validatedRequest, flexUserRoleValid([ROLES.all])],\n    async (request, response) => {\n      try {\n        const user = await userFromSession(request, response);\n        const { slashCommandId } = request.params;\n        const { command, prompt, description } = reqBody(request);","sourceCodeStart":1311,"sourceCodeEnd":1347,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/20f6d3546c1938bfea1ad304f58a592dddcc5948/server/endpoints/system.js#L1311-L1347","documentation":"POST /system/create-preset response when SlashCommandPresets.create() returns falsy — the preset persistence layer failed to store the new slash-command preset (command, prompt, description) without throwing. Returns HTTP 500; reserved-command conflicts are rejected separately with a distinct message.","triggerScenarios":"Thrown at server/endpoints/system.js:1315 when the library encounters an invalid state.","commonSituations":"Preset creation failed at the database layer.","solutions":["Check server logs for the database error.","Verify the preset payload is valid and retry."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"20f6d3546c1938bfea1ad304f58a592dddcc5948","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}