gitroomhq/postiz-app · error · BadRequestException

${validation.name}: ${validation.errors}

Error message

${validation.name}: ${validation.errors}

What it means

Provider-level content validation returned structured errors (validation.errors !== true) — e.g. a malformed mention, invalid URL card, unsupported media combination, or other provider-specific rule violations. The provider name prefixes the message.

Source

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

    ]);

    if (validation.emptyContent) {
      throw new BadRequestException(
        `${validation.name}: Your post should have at least one character or one image.`
      );
    }

    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

View on GitHub (pinned to 0f1647f749)

Solutions

  1. Read the provider-prefixed message — it names the exact rule that failed — and adjust that part of the content
  2. Simplify the variant (remove mentions/embeds/media combos) to isolate the offending element
  3. Per-channel tailor the variant rather than reusing one payload across providers
  4. Check provider validation schemas under libraries/.../validation for the exact constraints

Example fix

// before
posts: [{ integration: { id: redditId }, content: '...' /* missing/invalid title setting */ }]
// after
posts: [{ integration: { id: redditId }, content: '...', settings: { title: 'Valid title', ...validSettings } }]
Defensive patterns

Strategy: try-catch

Validate before calling

if (providerIdentifier === 'reddit' && !post.settings?.title) throw new Error('Reddit requires a title');

Try / catch

try {
  await schedulePost(orgId, body);
} catch (e) {
  const msg = String(e?.response?.message ?? e);
  if (e?.response?.status === 400 && !msg.includes('characters')) {
    highlightVariantIssue(msg); // surface provider-prefixed rule to the user
  } else throw e;
}

Prevention

When it happens

Trigger: Scheduling a non-draft post whose content violates provider rules: broken thread/reply structure, invalid link attachment format, disallowed media type for the channel, etc.

Common situations: Cross-posting the same content to channels with different rules (e.g. Reddit title constraints, Discord embed formats); API consumers hand-crafting mention or media structures; provider rule changes after a version upgrade.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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