{"record":{"id":"c104af722ddeec90","repo":"Mintplex-Labs/anything-llm","slug":"failed-to-publish-agent-flow-error-message","errorCode":null,"errorMessage":"Failed to publish agent flow: ${error.message}","messagePattern":"Failed to publish agent flow: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/components/CommunityHub/PublishEntityModal/AgentFlows/index.jsx","lineNumber":41,"sourceCode":"    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        tags: tags,\n        visibility: \"private\",\n        flow: JSON.stringify({\n          name: form.get(\"name\"),\n          description: form.get(\"description\"),\n          steps: entity.steps,\n          tags: tags,\n          visibility: \"private\",\n        }),\n      };\n      const { success, error, itemId } =\n        await CommunityHub.createAgentFlow(data);\n      if (!success) throw new Error(error);\n      setItemId(itemId);\n      setIsSuccess(true);\n    } catch (error) {\n      console.error(\"Failed to publish agent flow:\", error);\n      showToast(`Failed to publish agent flow: ${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":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/frontend/src/components/CommunityHub/PublishEntityModal/AgentFlows/index.jsx#L23-L59","documentation":"Community Hub publisher for Agent Flows. The modal builds a payload (name, description, steps, tags, visibility) and calls CommunityHub.createAgentFlow; on success:false the API's error string is rethrown, caught, and shown as a toast with the raw error.message appended after the colon. The generic prefix therefore always carries the specific backend reason with it.","triggerScenarios":"createAgentFlow rejects: missing/invalid fields (empty name or description), steps failing server-side validation, flow JSON too large, duplicate published item name, Community Hub session missing/expired, or a backend/network failure (non-2xx).","commonSituations":"Publishing while not signed in to the Community Hub; very long step payloads making JSON.stringify(steps) huge; hub API changed after an upgrade; transient outage or rate limiting of the hub.","solutions":["Read the full toast / console.error — the text after the colon is the API's actual rejection reason","Confirm you are authenticated to the Community Hub (connection/settings) and retry","Shorten the flow: fewer steps or smaller step configs if the serialized flow is very large","Fill every required form field (name, description) and ensure tags are valid before submitting"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"function validFlowPayload(form, entity, tags) {\n  const name = form.get(\"name\")?.trim();\n  const description = form.get(\"description\")?.trim();\n  if (!name || !description) return { ok: false, reason: \"name and description are required\" };\n  if (!entity?.steps?.length) return { ok: false, reason: \"flow has no steps\" };\n  if (JSON.stringify(entity.steps).length > MAX_FLOW_BYTES) return { ok: false, reason: \"flow too large\" };\n  return { ok: true };\n}","typeGuard":null,"tryCatchPattern":"catch (error) {\n  console.error(\"Failed to publish agent flow:\", error);\n  showToast(`Failed to publish agent flow: ${error.message}`, \"error\", { clear: true });\n  if (/unauthor|401|session/i.test(error.message)) openCommunityHubLogin();\n}","preventionTips":["Validate required fields client-side before calling createAgentFlow so API rejections are rare","Keep hub session state checked — most publish failures are auth-related","Cap flow payload size before stringify to avoid oversized-request failures"],"tags":["community-hub","agent-flows","publish","frontend"],"backgroundTag":"api-request-failed","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}