gitroomhq/postiz-app · error · BadRequestException

The publish time of this post already passed, it cannot be u

Error message

The publish time of this post already passed, it cannot be updated

What it means

A QUEUE post whose publishDate is already in the past cannot be updated — the scheduler may be picking it up, so mutations are locked. Updates are only allowed for scheduled posts still in the future.

Source

Thrown at libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts:1007

    }

    if (root.parentPostId) {
      throw new BadRequestException(
        'This id belongs to a comment, pass the id of the main post'
      );
    }

    if (root.state !== 'QUEUE' && root.state !== 'DRAFT') {
      throw new BadRequestException(
        'Only scheduled posts that were not published yet (or drafts) can be updated'
      );
    }

    if (
      root.state === 'QUEUE' &&
      dayjs.utc(root.publishDate).isBefore(dayjs.utc())
    ) {
      throw new BadRequestException(
        'The publish time of this post already passed, it cannot be updated'
      );
    }

    const integration = (root as any).integration;

    let existingSettings: Record<string, any>;
    try {
      existingSettings = JSON.parse(root.settings || '{}');
    } catch (err) {
      existingSettings = {};
    }

    // Merge: only the passed keys change, everything else stays.
    const mergedSettings = {
      ...existingSettings,
      ...(settings || {}),
      __type: integration.providerIdentifier,

View on GitHub (pinned to 0f1647f749)

Solutions

  1. Refresh and check the post state — if it published, create a new post instead
  2. If it errored and is still in QUEUE past its time, delete and reschedule with a new future date
  3. Guard the UI: disable save when publishDate is within a few minutes of now
  4. Verify server clock synchronization (NTP) if you suspect clock skew

Example fix

// before
await updatePost(orgId, postId, body); // publishDate already passed
// after
if (dayjs.utc(post.publishDate).isAfter(dayjs.utc())) {
  await updatePost(orgId, postId, body);
} else {
  await createPost(orgId, { ...body, type: 'schedule' });
}
Defensive patterns

Strategy: validation

Validate before calling

const isFuture = dayjs.utc(post.publishDate).isAfter(dayjs.utc());
if (post.state === 'QUEUE' && isFuture) await updatePost(orgId, postId, body);

Prevention

When it happens

Trigger: Calling updatePost on a post with state QUEUE where dayjs.utc(root.publishDate).isBefore(dayjs.utc()) — e.g. editing a post whose slot elapsed seconds ago while the editor was open.

Common situations: Long-open editor sessions on soon-to-publish posts; server/client clock skew making 'future' posts appear past on the server; retries after network delays on a post that just went due.

Related errors


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