gitroomhq/postiz-app · error · BadRequestException

${validation.name}: Your post should have at least one chara

Error message

${validation.name}: Your post should have at least one character or one image.

What it means

Per-provider validation (Zod schemas in libs/.../validation) checks that each post variant has content or media. emptyContent=true means the target channel received a post with no text and no image, which the provider rejects.

Source

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

      return {
        id: p.id,
        content: p.content,
        delay: p.delay || 0,
        image,
      };
    });

    // Same server-side validation as the dashboard / public create route.
    const [validation] = await this.validatePosts(orgId, [
      {
        integration: { id: integration.id },
        settings: mergedSettings,
        value: value.map((p) => ({ content: p.content, image: p.image })),
      },
    ]);

    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}`
        );
      }

View on GitHub (pinned to 0f1647f749)

Solutions

  1. Add at least one character of content or attach an image to every channel variant
  2. Remove the empty per-channel variant from the posts array instead of submitting it blank
  3. Check that image URLs survived upload; re-upload if the media failed
  4. Validate client-side per provider: content.trim() || image.length

Example fix

// before
{ integration: { id }, content: '', image: [] }
// after
{ integration: { id }, content: 'Check this out!', image: [] }
// or
{ integration: { id }, content: '', image: [uploadedImageUrl] }
Defensive patterns

Strategy: validation

Validate before calling

const hasContent = body.posts.every((p) => (p.content ?? '').trim().length > 0 || (p.image ?? []).length > 0);
if (hasContent) await createPost(orgId, body);

Prevention

When it happens

Trigger: Creating/updating a post where a per-channel variant has empty content and an empty/undefined image array (e.g. clearing the text box for one channel while drafting).

Common situations: Multi-channel composer with an emptied per-channel override; image upload failing silently leaving posts with neither text nor media; API payloads with content: '' and image: [].

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/4f1a888a74868b89. Report an issue: GitHub.