Mintplex-Labs/anything-llm · error

Failed to create preset

Error message

Failed to create preset

What it means

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.

Source

Thrown at server/endpoints/system.js:1329

        );

        if (isReservedCommand(formattedCommand)) {
          return response.status(400).json({
            message:
              "Cannot create a preset with a command that matches a system command",
          });
        }

        const presetData = {
          command: formattedCommand,
          prompt: String(prompt),
          description: String(description),
        };

        const preset = await SlashCommandPresets.create(user?.id, presetData);
        if (!preset) {
          return response
            .status(500)
            .json({ message: "Failed to create preset" });
        }
        response.status(201).json({ preset });
      } catch (error) {
        console.error("Error creating slash command preset:", error);
        response.status(500).json({ message: "Internal server error" });
      }
    }
  );

  app.post(
    "/system/slash-command-presets/:slashCommandId",
    [validatedRequest, flexUserRoleValid([ROLES.all])],
    async (request, response) => {
      try {
        const user = await userFromSession(request, response);
        const { slashCommandId } = request.params;
        const { command, prompt, description } = reqBody(request);

View on GitHub (pinned to 20f6d3546c)

Solutions

  1. Check server logs for the database error.
  2. Verify the preset payload is valid and retry.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at server/endpoints/system.js:1315 when the library encounters an invalid state.

Common situations: Preset creation failed at the database layer.


AI-assisted analysis of Mintplex-Labs/anything-llm@20f6d3546c (2026-08-18). Data as JSON: /api/errors/f69ce1e1b10f023c. Report an issue: GitHub.