{"record":{"id":"f734b03869fc5263","repo":"gitroomhq/postiz-app","slug":"failed-to-generate-posts-please-try-again","errorCode":null,"errorMessage":"Failed to generate posts, please try again.","messagePattern":"Failed to generate posts, please try again\\.","errorType":"error_code","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/frontend/src/components/launches/generator/generator.tsx","lineNumber":74,"sourceCode":"\n        // Convert chunked binary data to string\n        const chunkStr = decoder.decode(value, {\n          stream: true,\n        });\n        for (const chunk of chunkStr\n          .split('\\n')\n          .filter((f) => f && f.indexOf('{') > -1)) {\n          let data: any;\n          try {\n            data = JSON.parse(chunk);\n          } catch (e) {\n            /** ignore partial / unparseable chunks **/\n            continue;\n          }\n\n          // Server emits this when a node in the generation graph throws.\n          if (data?.error) {\n            throw new Error(\n              data.message ||\n                t('generation_failed', 'Failed to generate posts, please try again.')\n            );\n          }\n\n          {\n            switch (data.name) {\n              case 'agent':\n                setShowStep(t('agent_starting', 'Agent starting'));\n                break;\n              case 'research':\n                setShowStep(\n                  t('researching_your_content', 'Researching your content...')\n                );\n                break;\n              case 'find-category':\n                setShowStep(\n                  t(","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/gitroomhq/postiz-app/blob/0f1647f7491a217d43eb5ae7a480484bdf0aff3e/apps/frontend/src/components/launches/generator/generator.tsx#L56-L92","documentation":"While streaming the AI post generator response, the server can emit a chunk containing { error: ... } when a node in the generation graph throws. The client surfaces the server's message or falls back to the i18n string 'Failed to generate posts, please try again.'.","triggerScenarios":"POST /posts/generator where the SSE/stream response includes an error event: AI provider (LLM) API failure, rate limit, invalid API key for the LLM, or an internal exception in the generation workflow mid-stream.","commonSituations":"OpenAI/other LLM API key missing or quota exceeded in the backend; provider rate limits during peak use; prompt/context too long; transient LLM 5xx.","solutions":["Log data.message — it carries the server-side reason; check backend logs at the same timestamp","Verify the LLM provider API key and quota in backend environment","Retry: transient provider failures often succeed on the second attempt","If persistent, reduce the input size (fewer channels/shorter context) to rule out token limits"],"exampleFix":"// before\nif (data?.error) {\n  throw new Error(data.message || t('generation_failed', 'Failed to generate posts, please try again.'));\n}\n\n// after: keep server detail for debugging\nif (data?.error) {\n  console.error('generator stream error:', data.message);\n  throw new Error(data.message || t('generation_failed', 'Failed to generate posts, please try again.'));\n}","handlingStrategy":"retry","validationCode":"null","typeGuard":"const isGeneratorErrorChunk = (d: unknown): d is { error: true; message: string } => !!(d as any)?.error && typeof (d as any).message === 'string';","tryCatchPattern":"try { await generate(value); } catch (e) { if (/Failed to generate posts/.test(String(e))) { notify('Generation failed — retrying'); return generate(value); } throw e; }","preventionTips":["Keep the LLM API key and quota healthy in backend env","Preserve server error messages for diagnosis","Retry once on transient provider failures"],"tags":["ai","streaming","generator","frontend"],"backgroundTag":"ai-generation-failed","analyzedSha":"0f1647f7491a217d43eb5ae7a480484bdf0aff3e","analyzedAt":"2026-08-27T12:09:55.020Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}