{"record":{"id":"ee5b9ca22e592f71","repo":"gitroomhq/postiz-app","slug":"function-not-found","errorCode":null,"errorMessage":"Function not found","messagePattern":"Function not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/backend/src/api/routes/integrations.controller.ts","lineNumber":399,"sourceCode":"            return;\n          }\n\n          const { accessToken } = data;\n\n          if (accessToken) {\n            if (integrationProvider.refreshWait) {\n              await timer(10000);\n            }\n            return this.functionIntegration(org, body);\n          }\n\n          return false;\n        }\n\n        return false;\n      }\n    }\n    throw new Error('Function not found');\n  }\n\n  @Post('/disable')\n  disableChannel(\n    @GetOrgFromRequest() org: Organization,\n    @Body('id') id: string\n  ) {\n    return this._integrationService.disableChannel(org.id, id);\n  }\n\n  @Post('/enable')\n  enableChannel(\n    @GetOrgFromRequest() org: Organization,\n    @Body('id') id: string\n  ) {\n    return this._integrationService.enableChannel(\n      org.id,\n      // @ts-ignore","sourceCodeStart":381,"sourceCodeEnd":417,"githubUrl":"https://github.com/gitroomhq/postiz-app/blob/0f1647f7491a217d43eb5ae7a480484bdf0aff3e/apps/backend/src/api/routes/integrations.controller.ts#L381-L417","documentation":"Thrown by the integrations controller when the loop over an organization's integrations finishes without finding one whose id matches the requested channel id. It signals that the caller referenced a function/integration id that does not exist for this org.","triggerScenarios":"POST to an integration endpoint (e.g. /disable) with an 'id' that is not among the org's channels — stale id from another org, deleted channel, or typo'd/mangled request body.","commonSituations":"Client cached an old channel id after the channel was removed/reconnected; frontend sending id from a different organization; double-submit after deletion.","solutions":["Verify the id exists in the org's integration list (GET integrations) before calling","Refresh client-side cached channel data and retry with the current id","Check the request payload is not being truncated or overwritten by form encoding"],"exampleFix":"// before\nawait api.post('/integrations/disable', { id: staleId });\n// after\nconst channels = await api.get('/integrations');\nconst channel = channels.find(c => c.id === staleId);\nif (!channel) throw new Error('Channel no longer exists — refresh list');\nawait api.post('/integrations/disable', { id: channel.id });","handlingStrategy":"validation","validationCode":"const exists = (await api.get(`/organizations/${orgId}/integrations`)).some(i => i.id === targetId);\nif (!exists) throw new Error('Channel missing — refresh channel list');","typeGuard":"const isChannelOfOrg = (list: Integration[], id: string) => list.some(i => i.id === id);","tryCatchPattern":"try { await disable(id); } catch (e) { if (e.message === 'Function not found') await refreshChannels(); else throw e; }","preventionTips":["Refresh integration list before mutations","Invalidate cached ids on channel delete/reconnect events"],"tags":["integrations","channel-not-found","state"],"backgroundTag":"resource-not-found","analyzedSha":"0f1647f7491a217d43eb5ae7a480484bdf0aff3e","analyzedAt":"2026-08-27T12:09:55.020Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}