gitroomhq/postiz-app · error · BadBody

${handleError?.value || ''}

Error message

${handleError?.value || ''}

What it means

The non-business TikTok provider's checkPostStatus: when the direct-post poll returns status === 'FAILED', a BadBody ('titok-error-upload') is thrown with handleErrors' classified message or ''. TikTok definitively failed to publish the video.

Source

Thrown at libraries/nestjs-libraries/src/integrations/social/tiktok.provider.ts:489

    }

    if (status === 'PUBLISH_COMPLETE') {
      // an empty array is truthy, so index it once and branch on the value
      const publicPostId = publicaly_available_post_id?.[0];

      return {
        status: 'completed',
        releaseURL: !publicPostId
          ? `https://www.tiktok.com/@${integration.profile}`
          : `https://www.tiktok.com/@${integration.profile}/video/${publicPostId}`,
        // TikTok returns the id as a number, releaseId in the db is a string
        postId: !publicPostId ? pendingData.publishId : String(publicPostId),
      };
    }

    if (status === 'FAILED') {
      const handleError = this.handleErrors(JSON.stringify(post));
      throw new BadBody(
        'titok-error-upload',
        JSON.stringify(post),
        Buffer.from(JSON.stringify(post)),
        handleError?.value || ''
      );
    }

    return { status: 'pending', pendingData };
  }

  // UPLOAD does not publish - it only drops the media into the user's TikTok
  // inbox - so only an explicit UPLOAD selects it. A missing value (drafts, or
  // any caller that skipped the setting) publishes instead of silently landing
  // in the inbox.
  private contentPostingMethod(
    firstPost: PostDetails<TikTokDto>
  ): TikTokDto['content_posting_method'] {
    return firstPost?.settings?.content_posting_method === 'UPLOAD'

View on GitHub (pinned to 0f1647f749)

Solutions

  1. Check the logged post JSON for the failure field detail
  2. Re-encode the video to H.264/AAC MP4 and retry
  3. Ensure post parameters (privacy, disables) are valid for the app's scopes
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-flight: validate the uploaded video before scheduling the post
const ok = await ffprobeIsH264Mp4(video.url);
if (!ok) throw new Error('Re-encode video to H.264 MP4 before posting to TikTok');

Type guard

const isFailedStatus = (s?: string): s is 'FAILED' => s === 'FAILED';

Try / catch

try { await provider.check(post); } catch (e) { if (e instanceof BadBody && /titok-error-upload/.test(e.error)) markPostFailed(post, e.error); throw e; }

Prevention

When it happens

Trigger: Direct post ends in FAILED: video violates policy, is unplayable/corrupt, or the upload/publish parameters (privacy, music, hashtags) were rejected during async processing.

Common situations: Content moderation rejections, unsupported video codecs, or drafts never finalized within TikTok's processing window (note the typo'd identifier 'titok-error-upload').

Related errors


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