{"record":{"id":"c03c2ad9c1b0286d","repo":"gitroomhq/postiz-app","slug":"integration-with-id-post-integration-id-not-f","errorCode":null,"errorMessage":"Integration with id ${post?.integration?.id} not found","messagePattern":"Integration with id (.+?) not found","errorType":"validation","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts","lineNumber":782,"sourceCode":"    orgId: string,\n    posts: Array<{\n      integration: { id: string };\n      value: Array<{\n        content?: string;\n        image?: Array<{ path: string; thumbnail?: string }>;\n      }>;\n      settings?: any;\n    }>\n  ) {\n    return Promise.all(\n      (posts || []).map(async (post) => {\n        const integration = await this._integrationService.getIntegrationById(\n          orgId,\n          post?.integration?.id\n        );\n\n        if (!integration) {\n          throw new BadRequestException(\n            `Integration with id ${post?.integration?.id} not found`\n          );\n        }\n\n        const provider = this._integrationManager.getSocialIntegration(\n          integration.providerIdentifier\n        );\n\n        let additionalSettings: any[] = [];\n        try {\n          additionalSettings = JSON.parse(\n            integration.additionalSettings || '[]'\n          );\n        } catch {\n          additionalSettings = [];\n        }\n\n        const settings = post.settings || {};","sourceCodeStart":764,"sourceCodeEnd":800,"githubUrl":"https://github.com/gitroomhq/postiz-app/blob/0f1647f7491a217d43eb5ae7a480484bdf0aff3e/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts#L764-L800","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Refresh the integrations list and reselect the channel before saving the edit","Reconnect the social channel to create a new integration and update the post to use it","Delete and recreate the post if the original integration is gone and republishing is acceptable","Guard client-side: confirm the integration id exists before calling the update endpoint"],"exampleFix":"// before\nawait updatePost(orgId, { ...post, posts: post.posts }); // may contain dead integration id\n// after\nconst valid = await Promise.all(post.posts.map(p => integrationExists(orgId, p.integration.id)));\nif (valid.every(Boolean)) await updatePost(orgId, post);","handlingStrategy":"validation","validationCode":"const ids = new Set((await fetchIntegrations(orgId)).integrations.map((i) => i.id));\nif (post.posts.every((p) => ids.has(p.integration.id))) await updatePost(orgId, post);","typeGuard":null,"tryCatchPattern":"try {\n  await updatePost(orgId, post);\n} catch (e) {\n  if (/Integration with id .* not found/.test(String(e?.response?.message ?? e))) {\n    await promptReconnectChannel();\n  } else throw e;\n}","preventionTips":["Revalidate integration ids on edit-open, not just on submit","Handle channel disconnect events by invalidating posts referencing removed integrations"],"tags":["posts","integration","not-found","update"],"backgroundTag":"referenced-entity-not-found","analyzedSha":"0f1647f7491a217d43eb5ae7a480484bdf0aff3e","analyzedAt":"2026-08-27T12:09:55.020Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}