{"record":{"id":"cd5624634e59a5c7","repo":"Mintplex-Labs/anything-llm","slug":"failed-to-publish-prompt-error-message","errorCode":null,"errorMessage":"Failed to publish prompt: ${error.message}","messagePattern":"Failed to publish prompt: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/components/CommunityHub/PublishEntityModal/SystemPrompts/index.jsx","lineNumber":35,"sourceCode":"  const [itemId, setItemId] = useState(null);\n\n  const handleSubmit = async (e) => {\n    e.preventDefault();\n    e.stopPropagation();\n    setIsSubmitting(true);\n    try {\n      const form = new FormData(formRef.current);\n      const data = {\n        name: form.get(\"name\"),\n        description: form.get(\"description\"),\n        prompt: form.get(\"prompt\"),\n        tags: tags,\n        visibility: visibility,\n      };\n\n      const { success, error, itemId } =\n        await CommunityHub.createSystemPrompt(data);\n      if (!success) throw new Error(error);\n      setItemId(itemId);\n      setIsSuccess(true);\n    } catch (error) {\n      console.error(\"Failed to publish prompt:\", error);\n      showToast(`Failed to publish prompt: ${error.message}`, \"error\", {\n        clear: true,\n      });\n    } finally {\n      setIsSubmitting(false);\n    }\n  };\n\n  const handleKeyDown = (e) => {\n    if (e.key === \"Enter\" || e.key === \",\") {\n      e.preventDefault();\n      const value = tagInput.trim();\n      if (value.length > 20) return;\n      if (value && !tags.includes(value)) {","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/frontend/src/components/CommunityHub/PublishEntityModal/SystemPrompts/index.jsx#L17-L53","documentation":"Community Hub publisher for System Prompts. The modal gathers name, description, prompt, tags and visibility, then calls CommunityHub.createSystemPrompt; when the API answers success:false the error is rethrown and toasted as 'Failed to publish prompt: <reason>'.","triggerScenarios":"createSystemPrompt rejects: empty name/description/prompt fields, duplicate published prompt name, invalid tags, missing hub authentication, or a backend/network error.","commonSituations":"Not signed in to the Community Hub; publishing the same prompt name twice; prompt body too large; transient hub outage or version mismatch between client and server.","solutions":["Check the toast suffix and console.error for the API's specific message","Complete every field in the publish form before submitting","Rename the prompt if a duplicate-name rejection is reported","Confirm hub authentication is active, then retry once network/hub status is verified"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const name = form.get(\"name\")?.trim();\nconst description = form.get(\"description\")?.trim();\nconst prompt = form.get(\"prompt\")?.trim();\nif (!name || !description || !prompt) return disableSubmit(\"all fields are required\");","typeGuard":null,"tryCatchPattern":"catch (error) {\n  console.error(\"Failed to publish prompt:\", error);\n  showToast(`Failed to publish prompt: ${error.message}`, \"error\", { clear: true });\n  if (/unauthor|401/i.test(error.message)) promptHubReconnect();\n}","preventionTips":["Enforce non-empty name/description/prompt in the form before enabling submit","Verify the hub connection in the parent modal prior to mounting publishers","Surface the API suffix verbatim — it carries the actionable reason"],"tags":["community-hub","system-prompts","publish","frontend"],"backgroundTag":"api-request-failed","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}