{"record":{"id":"d8c36d4e2738f708","repo":"gitroomhq/postiz-app","slug":"invalid-body","errorCode":null,"errorMessage":"Invalid body","messagePattern":"Invalid body","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/backend/src/api/routes/integrations.controller.ts","lineNumber":136,"sourceCode":"            time: JSON.parse(p.postingTimes),\n            changeProfilePicture: !!findIntegration?.changeProfilePicture,\n            changeNickName: !!findIntegration?.changeNickname,\n            customer: p.customer,\n            additionalSettings: p.additionalSettings || '[]',\n          };\n        })\n      ),\n    };\n  }\n\n  @Post('/:id/settings')\n  async updateProviderSettings(\n    @GetOrgFromRequest() org: Organization,\n    @Param('id') id: string,\n    @Body('additionalSettings') body: string\n  ) {\n    if (typeof body !== 'string') {\n      throw new Error('Invalid body');\n    }\n\n    await this._integrationService.updateProviderSettings(org.id, id, body);\n  }\n  @Post('/:id/nickname')\n  async setNickname(\n    @GetOrgFromRequest() org: Organization,\n    @Param('id') id: string,\n    @Body() body: { name: string; picture: string }\n  ) {\n    const integration = await this._integrationService.getIntegrationById(\n      org.id,\n      id\n    );\n    if (!integration) {\n      throw new Error('Invalid integration');\n    }\n","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/gitroomhq/postiz-app/blob/0f1647f7491a217d43eb5ae7a480484bdf0aff3e/apps/backend/src/api/routes/integrations.controller.ts#L118-L154","documentation":"The bot-picture/nickname endpoint loads the channel integration by org+id; if getIntegrationById returns null (wrong id, integration belongs to another org, or was deleted/disconnected), Error('Invalid integration') is thrown.","triggerScenarios":"POST to the nickname/profile-picture route with an integration id that does not exist in the caller's organization — stale id from a removed channel, cross-org id, or typo.","commonSituations":"UI holding a cached integration list after the channel was disconnected; retrying an old request after re-authenticating into a different org; copy-pasting ids between environments.","solutions":["Refresh the integrations list in the UI and retry with a current integration id","Confirm the integration still exists for the active organization in the database","Handle 404-style cleanup: remove the stale channel from local state when this fails"],"exampleFix":"// before\nconst integration = cachedIntegrations.find(i => i.id === id);\nupdateNickname(id, nickname);\n// after\nconst integration = await refetchIntegrations().find(i => i.id === id);\nif (!integration) removeChannelFromState(id);\nelse updateNickname(id, nickname);","handlingStrategy":"validation","validationCode":"const integrations = await refetchIntegrations();\nif (!integrations.some(i => i.id === id)) throw new Error('Integration no longer connected');","typeGuard":"const isLiveIntegration = (id: string, list: Integration[]) => list.some(i => i.id === id);","tryCatchPattern":"try { await setNickname(id, nick); } catch (e) { if (e.message === 'Invalid integration') refreshChannelsAndDrop(id); else throw e; }","preventionTips":["Refetch the channel list on window focus/reconnect","Purge disconnected channel ids from local state and drafts"],"tags":["integrations","not-found","stale-id"],"backgroundTag":"entity-not-found","analyzedSha":"0f1647f7491a217d43eb5ae7a480484bdf0aff3e","analyzedAt":"2026-08-27T12:09:55.020Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}