gitroomhq/postiz-app · error · BadBody
X created the article draft but could not publish it, check
Error message
X created the article draft but could not publish it, check your drafts on X
What it means
The X article draft was created (draftJson.data.id exists) but the subsequent publish call returned no data.post_id, so the article exists only as a draft on X. The error tells the user to check their drafts on X rather than silently failing.
Source
Thrown at libraries/nestjs-libraries/src/integrations/social/x.provider.ts:1157
accessSecretSplit
),
'Content-Type': 'application/json',
},
});
const publishJson = (await publishResponse.json()) as {
data?: { post_id: string };
errors?: any[];
};
if (publishJson?.errors?.length) {
console.log(
'X article publish returned errors:',
JSON.stringify(publishJson.errors)
);
}
if (!publishJson?.data?.post_id) {
throw new BadBody(
this.identifier,
JSON.stringify(publishJson),
Buffer.from('{}'),
'X created the article draft but could not publish it, check your drafts on X'
);
}
return {
status: 'completed',
postId: publishJson.data.post_id,
releaseURL: `https://twitter.com/${integration.profile}/status/${publishJson.data.post_id}`,
};
}
override async finalizePost(
accessToken: string,
pendingData: XPendingData,
integration: IntegrationView on GitHub (pinned to 0f1647f749)
Solutions
- Open X and check the account's drafts — the article text is likely there; publish or fix it manually
- Inspect publishJson in the error body for the specific errors array
- Verify the account has permission to publish articles programmatically
- Retry the post once to rule out transient publish errors
Defensive patterns
Strategy: fallback
Type guard
const hasPublishedPostId = (j: unknown): j is { data: { post_id: string } } => Boolean((j as any)?.data?.post_id); Try / catch
catch (e) { if (e instanceof BadBody && e.message.includes('could not publish it')) { /* notify user draft exists on X; offer manual publish */ } throw e; } Prevention
- Warn users their draft may exist on X when publish fails
- Check publishJson.errors for actionable permission issues
- Keep draft fallback UX so content is never lost
When it happens
Trigger: Publish endpoint returns errors (validation on publish, permission to publish articles missing, rate limit) or an envelope lacking post_id even though the draft step succeeded.
Common situations: Account can draft but not auto-publish articles (feature gating); X changed the publish response shape; publish called with a malformed draft id.
Related errors
- X could not create the article draft
- X failed to process the uploaded video${(processing as any)?
- X failed to process the uploaded video${processing?.error?.m
- X may have already published this post, please check your ac
- handleError.value
AI-assisted analysis of gitroomhq/postiz-app@0f1647f749 (2026-08-27).
Data as JSON: /api/errors/c39852a70f9b708f.
Report an issue: GitHub.