Mintplex-Labs/anything-llm · error · Error

response.error || "Failed to create slash command"

Error message

response.error || "Failed to create slash command"

What it means

Frontend guard in CommunityHub.createSlashCommand: the slash-command create endpoint returned a non-ok status, so the command was not published; the backend's error message is surfaced when present, otherwise 'Failed to create slash command'.

Source

Thrown at frontend/src/models/communityHub.js:223

   * @param {Object} data - The slash command data
   * @param {string} data.name - The name of the command
   * @param {string} data.description - The description of the command
   * @param {string} data.command - The actual command text
   * @param {string} data.prompt - The prompt for the command
   * @param {string[]} data.tags - Array of tags
   * @param {string} data.visibility - Either 'public' or 'private'
   * @returns {Promise<{success: boolean, error: string | null}>}
   */
  createSlashCommand: async (data) => {
    return await fetch(`${API_BASE}/community-hub/slash-command/create`, {
      method: "POST",
      headers: baseHeaders(),
      body: JSON.stringify(data),
    })
      .then(async (res) => {
        const response = await res.json();
        if (!res.ok)
          throw new Error(response.error || "Failed to create slash command");
        return { success: true, error: null, itemId: response.item?.id };
      })
      .catch((e) => ({
        success: false,
        error: e.message,
      }));
  },
};

export default CommunityHub;

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Validate the slash command name and prompt fields.
  2. Check the Community Hub connection key.
  3. Review the returned error for details.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown when creating a slash command via the Community Hub fails.

Common situations: Invalid slash command definition or hub connection issue.


AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18). Data as JSON: /api/errors/2ec93a1d1d5f94ff. Report an issue: GitHub.