gitroomhq/postiz-app · error · BadRequestException

${validation.name}: The maximum characters is ${validation.m

Error message

${validation.name}: The maximum characters is ${validation.maximumCharacters}

What it means

Character-count validation per provider: the variant's content exceeds maximumCharacters for that channel (which varies — e.g. ~280 for X, 2200 for Instagram, and different counts when media is attached). Applies to non-draft posts.

Source

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

    }

    if (root.state !== 'DRAFT') {
      if (!validation.valid) {
        throw new BadRequestException(
          `${validation.name}: ${
            validation.settingsError || 'Please fix your settings'
          }`
        );
      }

      if (validation.errors !== true) {
        throw new BadRequestException(
          `${validation.name}: ${validation.errors}`
        );
      }

      if (validation.tooLong) {
        throw new BadRequestException(
          `${validation.name}: The maximum characters is ${validation.maximumCharacters}`
        );
      }
    }

    const date = dayjs.utc(root.publishDate).format('YYYY-MM-DDTHH:mm:ss');

    const [output] = await this.createPost(
      orgId,
      {
        date,
        // Settings-only update: keep the current state and leave the running
        // publish workflow alone.
        type: 'update',
        shortLink: false,
        tags: ((root as any).tags || []).map((t: any) => ({
          value: t.tag.name,
          label: t.tag.name,

View on GitHub (pinned to 0f1647f749)

Solutions

  1. Shorten the content for that channel to at or below maximumCharacters from the message
  2. Use the per-channel override editor to tailor length instead of broadcasting one text
  3. Move overflow into a thread or the first comment where the provider supports it
  4. Add a live character counter per provider in the UI

Example fix

// before
{ integration: { id: xId }, content: longText300Chars }
// after
{ integration: { id: xId }, content: longText.slice(0, maximumCharacters) }
// or split into thread parts
Defensive patterns

Strategy: validation

Validate before calling

const max = MAX_CHARS[providerIdentifier] ?? 5000;
if (post.content.length > max) throw new Error(`Too long for ${providerIdentifier}: ${post.content.length}/${max}`);

Prevention

When it happens

Trigger: Scheduling a post whose per-channel content length exceeds the provider max after counting URLs, mentions, and media adjustments — e.g. pasting a 300-character blurb into an X variant.

Common situations: Cross-posting long content to character-limited channels; link shorteners changing effective length; emoji counting as multiple characters; per-channel overrides not trimmed when the main composer text is long.

Related errors


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