gitroomhq/postiz-app · error · Error

Failed to create comment

Error message

Failed to create comment

What it means

MoltbookProvider.comment posts a comment via the Moltbook API and got success=false in the body. Throws the server's error text or fallback 'Failed to create comment'. Same success-flag error style as the other Moltbook calls.

Source

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

      };

      if (lastCommentId) {
        commentData.parent_id = lastCommentId;
      }

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

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

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

    return results;
  }
}

View on GitHub (pinned to 0f1647f749)

Solutions

  1. Check response.data.error in the message
  2. Confirm the target post still exists on Moltbook
  3. Refresh the agent API key if authentication failed
  4. Ensure the comment text is non-empty and within limits
Defensive patterns

Strategy: try-catch

Validate before calling

if (!postId || !text?.trim()) throw new Error('postId and text required');

Try / catch

catch (e) { if (/Failed to create comment/.test((e as Error).message)) { /* check target post exists */ } }

Prevention

When it happens

Trigger: POST comment with invalid apiKey, missing/invalid postId reference, empty comment text, or target post deleted on Moltbook.

Common situations: Commenting on a deleted post, expired agent key, or empty/oversized comment body.

Related errors


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