Mintplex-Labs/anything-llm · error

Cannot create a preset with a command that matches a system

Error message

Cannot create a preset with a command that matches a system command

What it means

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.

Source

Thrown at server/endpoints/system.js:1314

        console.error("Error fetching slash command presets:", error);
        response.status(500).json({ message: "Internal server error" });
      }
    }
  );

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

        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 });

View on GitHub (pinned to 20f6d3546c)

Solutions

  1. Choose a preset command that does not collide with a built-in system command.
  2. Prefix custom commands to avoid system names.
Defensive patterns

Strategy: try-catch

When it happens

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

Common situations: Creating a slash-command preset whose command matches a reserved system command.


AI-assisted analysis of Mintplex-Labs/anything-llm@20f6d3546c (2026-09-01). Data as JSON: /api/errors/05334c58631abaed. Report an issue: GitHub.