ComposioHQ/composio · error · Error

No run ID found

Error message

No run ID found

What it means

OpenAIProvider.waitAndHandleAssistantStreamToolCalls throws 'No run ID found' when it finishes consuming a streamed assistant (OpenAI Assistants API) response without ever observing a run ID. Without a run ID the SDK cannot retrieve the final run to inspect required actions/tool calls, so the streaming tool-call handling aborts.

Solutions

  1. Check that you pass the correct threadId and that the run was created and streamed via client.beta.threads.runs.stream
  2. Pin/upgrade the openai package to a version compatible with your @composio/core version so run-identification events are parsed
  3. Log the raw stream events to confirm a thread.run event with an id is present; if absent, inspect network/proxy interference
  4. Retry the request — transient truncation can cause a missing run event
Defensive patterns

Strategy: retry

Validate before calling

if (!threadId || !runId) throw new Error('Missing thread/run before streaming assistant tool calls');

Try / catch

try { await waitAndHandleAssistantStreamToolCalls(...); } catch (e) { if (e instanceof Error && e.message === 'No run ID found') { await retryWithBackoff(...); } else throw e; }

Prevention

When it happens

Trigger: Streaming an OpenAI Assistant response (client.beta.threads.runs.stream) where the stream completes but no event carrying thread.run.id (or equivalent run identifier) arrives — e.g. malformed/partial stream, unexpected event ordering, or an API response shape change from a version bump of the openai package.

Common situations: Upgrading the openai SDK or Composio SDK where stream event names changed; proxy or gateway stripping SSE events; network interruption truncating the stream before the run event; using a thread/run created outside the SDK.

Related errors


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

Appendix: source

Thrown at ts/packages/core/src/provider/OpenAIProvider.ts:480

          tool_outputs: toolOutputs,
        });
      }

      // Break if the run status becomes inactive
      if (
        [
          'thread.run.completed',
          'thread.run.failed',
          'thread.run.cancelled',
          'thread.run.expired',
        ].includes(event.event)
      ) {
        break;
      }
    }

    if (!runId) {
      throw new Error('No run ID found');
    }

    // Handle any final actions after the stream ends
    let finalRun = await client.beta.threads.runs.retrieve(runId, {
      thread_id: thread.id,
    });

    while (['queued', 'in_progress', 'requires_action'].includes(finalRun.status)) {
      if (finalRun.status === 'requires_action') {
        const toolOutputs = await this.handleAssistantMessage(userId, finalRun, options, modifiers);

        // Submit tool outputs
        finalRun = await client.beta.threads.runs.submitToolOutputs(runId, {
          thread_id: thread.id,
          tool_outputs: toolOutputs,
        });
      } else {
        // Update the run status

View on GitHub (pinned to 64b1b85502)