Mintplex-Labs/anything-llm · error

Unknown error

Error message

Unknown error

What it means

Produced in CommunityHub.createStaticItem: the outbound POST ${apiBase}/${itemType}/create to the remote Community Hub returned a JSON body with a truthy error field, and that message is rethrown (the 'Unknown error' literal only survives when the field is truthy but stringifies empty — practically you will see the remote's message). The .catch converts it to { success:false, error } which the admin endpoint then throws, so users see the Hub's own error text.

Source

Thrown at server/models/communityHub.js:203

    if (!connectionKey)
      return { success: false, error: "Connection key is required" };
    if (!this.supportedStaticItemTypes.includes(itemType))
      return { success: false, error: "Unsupported item type" };

    // If the item has special considerations or preprocessing, we can delegate that below before sending the request.
    // eg: Agent flow files and such.

    return await fetch(`${this.apiBase}/${itemType}/create`, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        Authorization: `Bearer ${connectionKey}`,
      },
      body: JSON.stringify(data),
    })
      .then((response) => response.json())
      .then((result) => {
        if (!!result.error) throw new Error(result.error || "Unknown error");
        return { success: true, error: null, itemId: result.item.id };
      })
      .catch((error) => {
        console.error(`Error creating ${itemType}:`, error);
        return { success: false, error: error.message };
      });
  },
};

module.exports = { CommunityHub };

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Read the surfaced message — it is the remote Hub's error and states the exact rejection (auth, validation, unsupported type)
  2. If it is an auth error, re-paste a fresh connection key in Admin -> Community Hub settings and retry
  3. Trim/fix the payload (required metadata, size limits) and confirm the itemType is one of the currently published types
  4. Check server logs: the model logs 'Error creating ${itemType}:' with the full response for cases where the message is vague
Defensive patterns

Strategy: fallback

Validate before calling

const REQUIRED_FIELDS = { prompt: ['command', 'prompt'], 'slash-command': ['command', 'prompt'] };
function validHubItem(type, data) {
  const req = REQUIRED_FIELDS[type];
  if (!req) return false;
  return req.every((f) => typeof data?.[f] === 'string' && data[f].length > 0);
}
if (!validHubItem(itemType, data)) throw new Error('item missing required fields for Hub create');

Try / catch

// createStaticItem already returns { success:false, error } instead of throwing — branch on it:
const { success, error, itemId } = await CommunityHub.createStaticItem(type, data, key);
if (!success) { /* show error (remote Hub message); auth errors -> reconfigure key, validation errors -> fix payload */ }

Prevention

When it happens

Trigger: Publishing with a stale/revoked connectionKey (remote auth failure); itemType or payload fields the Hub rejects (unsupported item type, missing required fields, schema mismatch after a Hub API update); network middleboxes returning JSON error bodies; publishing an item type still in beta/agent-flow files not enabled for your account.

Common situations: Key rotated on the Hub but not updated locally; version skew between a self-hosted server and the current Hub API contract; oversized or malformed item payloads (too-long prompt text, invalid JSON metadata).

Related errors


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