ComposioHQ/composio · error · Error

Invalid chunked trigger data format

Error message

Invalid chunked trigger data format

What it means

Composio delivers large trigger payloads over Pusher in chunks ({id, index, chunk, final}). bindWithChunking validates each chunk, and throws 'Invalid chunked trigger data format' when a received event lacks a string id or numeric index — i.e. the chunk envelope is malformed.

Source

Thrown at ts/packages/core/src/utils/pusher.ts:180

      channel.bind(event, safeCallback);

      // Now the chunked variation. Allows arbitrarily long messages.
      const events: {
        [key: string]: { chunks: string[]; receivedFinal: boolean };
      } = {};

      channel.bind('chunked-' + event, data => {
        try {
          const typedData = data as TChunkedTriggerData;

          // Validate chunked data
          if (
            !typedData ||
            typeof typedData.id !== 'string' ||
            typeof typedData.index !== 'number'
          ) {
            throw new Error('Invalid chunked trigger data format');
          }

          if (!events.hasOwnProperty(typedData.id)) {
            events[typedData.id] = { chunks: [], receivedFinal: false };
          }

          const ev = events[typedData.id];
          ev.chunks[typedData.index] = typedData.chunk;

          if (typedData.final) ev.receivedFinal = true;

          if (ev.receivedFinal && ev.chunks.length === Object.keys(ev.chunks).length) {
            try {
              const parsedData = JSON.parse(ev.chunks.join(''));
              safeCallback(parsedData);
            } catch (parseError: unknown) {
              const errorMessage =
                parseError instanceof Error ? parseError.message : String(parseError);

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Upgrade @composio/core to the latest version so the chunking contract matches the backend
  2. Retry the trigger subscription to re-establish a clean channel state
  3. If persistent, capture the raw payload via debug logs and report it with your SDK version to Composio support
Defensive patterns

Strategy: try-catch

Type guard

const isChunk = (d: unknown): d is { id: string; index: number } =>
  typeof d === 'object' && d !== null &&
  typeof (d as any).id === 'string' && typeof (d as any).index === 'number';

Try / catch

try {
  PusherUtils.triggerSubscribe(clientId, fn);
} catch (e) {
  if (e instanceof Error && e.message.includes('chunked trigger data')) {
    // re-subscribe or report; do not crash the process
  }
}

Prevention

When it happens

Trigger: A trigger event arrives on the private-{clientId}_triggers channel whose payload is not a valid TChunkedTriggerData (missing id/index or wrong types), typically when the SDK version's chunking contract mismatches the backend's, or a non-chunked/foreign event is delivered on the channel.

Common situations: SDK version skew with the Composio backend during/after a chunking protocol change; events routed to the wrong channel; corrupted payloads via intercepting proxies.

Related errors


AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28). Data as JSON: /api/errors/4507c9c3f881f870. Report an issue: GitHub.