{"record":{"id":"5900ebdab47d4b65","repo":"Mintplex-Labs/anything-llm","slug":"unknown-error","errorCode":null,"errorMessage":"Unknown error","messagePattern":"Unknown error","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/models/communityHub.js","lineNumber":203,"sourceCode":"    if (!connectionKey)\n      return { success: false, error: \"Connection key is required\" };\n    if (!this.supportedStaticItemTypes.includes(itemType))\n      return { success: false, error: \"Unsupported item type\" };\n\n    // If the item has special considerations or preprocessing, we can delegate that below before sending the request.\n    // eg: Agent flow files and such.\n\n    return await fetch(`${this.apiBase}/${itemType}/create`, {\n      method: \"POST\",\n      headers: {\n        \"Content-Type\": \"application/json\",\n        Authorization: `Bearer ${connectionKey}`,\n      },\n      body: JSON.stringify(data),\n    })\n      .then((response) => response.json())\n      .then((result) => {\n        if (!!result.error) throw new Error(result.error || \"Unknown error\");\n        return { success: true, error: null, itemId: result.item.id };\n      })\n      .catch((error) => {\n        console.error(`Error creating ${itemType}:`, error);\n        return { success: false, error: error.message };\n      });\n  },\n};\n\nmodule.exports = { CommunityHub };\n","sourceCodeStart":185,"sourceCodeEnd":214,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/models/communityHub.js#L185-L214","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Read the surfaced message — it is the remote Hub's error and states the exact rejection (auth, validation, unsupported type)","If it is an auth error, re-paste a fresh connection key in Admin -> Community Hub settings and retry","Trim/fix the payload (required metadata, size limits) and confirm the itemType is one of the currently published types","Check server logs: the model logs 'Error creating ${itemType}:' with the full response for cases where the message is vague"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"const REQUIRED_FIELDS = { prompt: ['command', 'prompt'], 'slash-command': ['command', 'prompt'] };\nfunction validHubItem(type, data) {\n  const req = REQUIRED_FIELDS[type];\n  if (!req) return false;\n  return req.every((f) => typeof data?.[f] === 'string' && data[f].length > 0);\n}\nif (!validHubItem(itemType, data)) throw new Error('item missing required fields for Hub create');","typeGuard":null,"tryCatchPattern":"// createStaticItem already returns { success:false, error } instead of throwing — branch on it:\nconst { success, error, itemId } = await CommunityHub.createStaticItem(type, data, key);\nif (!success) { /* show error (remote Hub message); auth errors -> reconfigure key, validation errors -> fix payload */ }","preventionTips":["Validate item payloads against the Hub's required schema before publishing","Keep the connectionKey current — most opaque failures here are upstream auth rejections","Log the itemType with the error (the model logs 'Error creating ${itemType}:') to correlate failures across publishes"],"tags":["anythingllm","community-hub","publishing","upstream-api","http"],"backgroundTag":"upstream-api-error","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}