gitroomhq/postiz-app · error · Error

Invalid body

Error message

Invalid body

What it means

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.

Source

Thrown at apps/backend/src/api/routes/integrations.controller.ts:136

            time: JSON.parse(p.postingTimes),
            changeProfilePicture: !!findIntegration?.changeProfilePicture,
            changeNickName: !!findIntegration?.changeNickname,
            customer: p.customer,
            additionalSettings: p.additionalSettings || '[]',
          };
        })
      ),
    };
  }

  @Post('/:id/settings')
  async updateProviderSettings(
    @GetOrgFromRequest() org: Organization,
    @Param('id') id: string,
    @Body('additionalSettings') body: string
  ) {
    if (typeof body !== 'string') {
      throw new Error('Invalid body');
    }

    await this._integrationService.updateProviderSettings(org.id, id, body);
  }
  @Post('/:id/nickname')
  async setNickname(
    @GetOrgFromRequest() org: Organization,
    @Param('id') id: string,
    @Body() body: { name: string; picture: string }
  ) {
    const integration = await this._integrationService.getIntegrationById(
      org.id,
      id
    );
    if (!integration) {
      throw new Error('Invalid integration');
    }

View on GitHub (pinned to 0f1647f749)

Solutions

  1. Refresh the integrations list in the UI and retry with a current integration id
  2. Confirm the integration still exists for the active organization in the database
  3. Handle 404-style cleanup: remove the stale channel from local state when this fails

Example fix

// before
const integration = cachedIntegrations.find(i => i.id === id);
updateNickname(id, nickname);
// after
const integration = await refetchIntegrations().find(i => i.id === id);
if (!integration) removeChannelFromState(id);
else updateNickname(id, nickname);
Defensive patterns

Strategy: validation

Validate before calling

const integrations = await refetchIntegrations();
if (!integrations.some(i => i.id === id)) throw new Error('Integration no longer connected');

Type guard

const isLiveIntegration = (id: string, list: Integration[]) => list.some(i => i.id === id);

Try / catch

try { await setNickname(id, nick); } catch (e) { if (e.message === 'Invalid integration') refreshChannelsAndDrop(id); else throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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