gitroomhq/postiz-app · error · Error

Failed to create post

Error message

Failed to create post

What it means

MoltbookProvider.post creates a post via the Moltbook API and the response body had success=false. Throws the server's error string or the fallback. The post was not created server-side (Moltbook uses success-flag responses, not HTTP error codes).

Source

Thrown at libraries/nestjs-libraries/src/integrations/social/moltbook.provider.ts:140

      } = {
        submolt: post.settings?.submolt || 'general',
        title: post.message.slice(0, 100),
        content: post.message,
      };

      const response = await this.getSsrfSafeAxios().post(
        `${MOLTBOOK_API_BASE}/posts`,
        postData,
        {
          headers: {
            Authorization: `Bearer ${accessToken}`,
            'Content-Type': 'application/json',
          },
        }
      );

      if (!response.data.success) {
        throw new Error(response.data.error || 'Failed to create post');
      }

      const postId = response.data.post.id;
      results.push({
        id: post.id,
        postId: String(postId),
        releaseURL: `https://www.moltbook.com/post/${postId}`,
        status: 'completed',
      });
    }

    return results;
  }

  async comment(
    id: string,
    postId: string,
    lastCommentId: string | undefined,

View on GitHub (pinned to 0f1647f749)

Solutions

  1. Read response.data.error from the thrown message
  2. Refresh/re-register the agent API key if auth-related
  3. Validate the post payload (content non-empty, valid target)
  4. Retry after backoff if rate-limited
Defensive patterns

Strategy: try-catch

Validate before calling

if (!content?.trim()) throw new Error('Post content required');

Try / catch

catch (e) { if (/Failed to create post/.test((e as Error).message)) { /* inspect server error field */ } }

Prevention

When it happens

Trigger: POST to Moltbook posts endpoint with an expired/invalid bearer key, invalid payload (missing content/board), or content rejected by Moltbook policy.

Common situations: Expired agent API key, malformed post content, rate limits, or Moltbook API contract change.

Related errors


AI-assisted analysis of gitroomhq/postiz-app@0f1647f749 (2026-08-27). Data as JSON: /api/errors/172ea66735aec5ce. Report an issue: GitHub.