gitroomhq/postiz-app · error · BadRequestException

Integration with id ${post?.integration?.id} not found

Error message

Integration with id ${post?.integration?.id} not found

What it means

PostsService.validatePosts re-resolves every post's integration by id within the organization during post update/validation. A missing integration aborts validation with the offending id in the message, mirroring the create-time check but on the update path.

Source

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

    orgId: string,
    posts: Array<{
      integration: { id: string };
      value: Array<{
        content?: string;
        image?: Array<{ path: string; thumbnail?: string }>;
      }>;
      settings?: any;
    }>
  ) {
    return Promise.all(
      (posts || []).map(async (post) => {
        const integration = await this._integrationService.getIntegrationById(
          orgId,
          post?.integration?.id
        );

        if (!integration) {
          throw new BadRequestException(
            `Integration with id ${post?.integration?.id} not found`
          );
        }

        const provider = this._integrationManager.getSocialIntegration(
          integration.providerIdentifier
        );

        let additionalSettings: any[] = [];
        try {
          additionalSettings = JSON.parse(
            integration.additionalSettings || '[]'
          );
        } catch {
          additionalSettings = [];
        }

        const settings = post.settings || {};

View on GitHub (pinned to 0f1647f749)

Solutions

  1. Refresh the integrations list and reselect the channel before saving the edit
  2. Reconnect the social channel to create a new integration and update the post to use it
  3. Delete and recreate the post if the original integration is gone and republishing is acceptable
  4. Guard client-side: confirm the integration id exists before calling the update endpoint

Example fix

// before
await updatePost(orgId, { ...post, posts: post.posts }); // may contain dead integration id
// after
const valid = await Promise.all(post.posts.map(p => integrationExists(orgId, p.integration.id)));
if (valid.every(Boolean)) await updatePost(orgId, post);
Defensive patterns

Strategy: validation

Validate before calling

const ids = new Set((await fetchIntegrations(orgId)).integrations.map((i) => i.id));
if (post.posts.every((p) => ids.has(p.integration.id))) await updatePost(orgId, post);

Try / catch

try {
  await updatePost(orgId, post);
} catch (e) {
  if (/Integration with id .* not found/.test(String(e?.response?.message ?? e))) {
    await promptReconnectChannel();
  } else throw e;
}

Prevention

When it happens

Trigger: Updating a post (type 'update' or action 'update') whose payload references an integration id that no longer exists in the organization — e.g. the channel was disconnected between scheduling and editing.

Common situations: Editing a scheduled post after the connected account was removed; integration ids from a different org leaking into update payloads; switching organizations in the UI while an editor session holds old ids.

Related errors


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