{"record":{"id":"c7fa0a6bbc01e3a2","repo":"gitroomhq/postiz-app","slug":"validation-name-validation-errors","errorCode":null,"errorMessage":"${validation.name}: ${validation.errors}","messagePattern":"\\$\\{validation\\.name\\}: \\$\\{validation\\.errors\\}","errorType":"validation","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts","lineNumber":1068,"sourceCode":"    ]);\n\n    if (validation.emptyContent) {\n      throw new BadRequestException(\n        `${validation.name}: Your post should have at least one character or one image.`\n      );\n    }\n\n    if (root.state !== 'DRAFT') {\n      if (!validation.valid) {\n        throw new BadRequestException(\n          `${validation.name}: ${\n            validation.settingsError || 'Please fix your settings'\n          }`\n        );\n      }\n\n      if (validation.errors !== true) {\n        throw new BadRequestException(\n          `${validation.name}: ${validation.errors}`\n        );\n      }\n\n      if (validation.tooLong) {\n        throw new BadRequestException(\n          `${validation.name}: The maximum characters is ${validation.maximumCharacters}`\n        );\n      }\n    }\n\n    const date = dayjs.utc(root.publishDate).format('YYYY-MM-DDTHH:mm:ss');\n\n    const [output] = await this.createPost(\n      orgId,\n      {\n        date,\n        // Settings-only update: keep the current state and leave the running","sourceCodeStart":1050,"sourceCodeEnd":1086,"githubUrl":"https://github.com/gitroomhq/postiz-app/blob/0f1647f7491a217d43eb5ae7a480484bdf0aff3e/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts#L1050-L1086","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the provider-prefixed message — it names the exact rule that failed — and adjust that part of the content","Simplify the variant (remove mentions/embeds/media combos) to isolate the offending element","Per-channel tailor the variant rather than reusing one payload across providers","Check provider validation schemas under libraries/.../validation for the exact constraints"],"exampleFix":"// before\nposts: [{ integration: { id: redditId }, content: '...' /* missing/invalid title setting */ }]\n// after\nposts: [{ integration: { id: redditId }, content: '...', settings: { title: 'Valid title', ...validSettings } }]","handlingStrategy":"try-catch","validationCode":"if (providerIdentifier === 'reddit' && !post.settings?.title) throw new Error('Reddit requires a title');","typeGuard":null,"tryCatchPattern":"try {\n  await schedulePost(orgId, body);\n} catch (e) {\n  const msg = String(e?.response?.message ?? e);\n  if (e?.response?.status === 400 && !msg.includes('characters')) {\n    highlightVariantIssue(msg); // surface provider-prefixed rule to the user\n  } else throw e;\n}","preventionTips":["Tailor content per channel instead of broadcasting identical payloads","Keep a per-provider constraint map client-side for early feedback","Stay current with provider validation schemas after upgrades"],"tags":["posts","validation","provider","content-rules"],"backgroundTag":"schema-validation-failed","analyzedSha":"0f1647f7491a217d43eb5ae7a480484bdf0aff3e","analyzedAt":"2026-08-27T12:09:55.020Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}