gitroomhq/postiz-app · error · Error
Failed to generate posts, please try again.
Error message
Failed to generate posts, please try again.
What it means
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.'.
Source
Thrown at apps/frontend/src/components/launches/generator/generator.tsx:74
// Convert chunked binary data to string
const chunkStr = decoder.decode(value, {
stream: true,
});
for (const chunk of chunkStr
.split('\n')
.filter((f) => f && f.indexOf('{') > -1)) {
let data: any;
try {
data = JSON.parse(chunk);
} catch (e) {
/** ignore partial / unparseable chunks **/
continue;
}
// Server emits this when a node in the generation graph throws.
if (data?.error) {
throw new Error(
data.message ||
t('generation_failed', 'Failed to generate posts, please try again.')
);
}
{
switch (data.name) {
case 'agent':
setShowStep(t('agent_starting', 'Agent starting'));
break;
case 'research':
setShowStep(
t('researching_your_content', 'Researching your content...')
);
break;
case 'find-category':
setShowStep(
t(View on GitHub (pinned to 0f1647f749)
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
Example fix
// before
if (data?.error) {
throw new Error(data.message || t('generation_failed', 'Failed to generate posts, please try again.'));
}
// after: keep server detail for debugging
if (data?.error) {
console.error('generator stream error:', data.message);
throw new Error(data.message || t('generation_failed', 'Failed to generate posts, please try again.'));
} Defensive patterns
Strategy: retry
Validate before calling
null
Type guard
const isGeneratorErrorChunk = (d: unknown): d is { error: true; message: string } => !!(d as any)?.error && typeof (d as any).message === 'string'; Try / catch
try { await generate(value); } catch (e) { if (/Failed to generate posts/.test(String(e))) { notify('Generation failed — retrying'); return generate(value); } throw e; } Prevention
- Keep the LLM API key and quota healthy in backend env
- Preserve server error messages for diagnosis
- Retry once on transient provider failures
When it happens
Trigger: 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.
Common situations: 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.
Related errors
AI-assisted analysis of gitroomhq/postiz-app@0f1647f749 (2026-08-27).
Data as JSON: /api/errors/f734b03869fc5263.
Report an issue: GitHub.