High severity beginner · Fix: 2-5 min

ComposioIntegrationNotConnectedError

composio.errors.ComposioIntegrationNotConnectedError

What this error means
The Composio client failed to connect because the integration was not properly initialized or authenticated.

Stack trace

traceback
Traceback (most recent call last):
  File "app.py", line 42, in <module>
    composio_client.send_event(event)
  File "/usr/local/lib/python3.9/site-packages/composio/client.py", line 88, in send_event
    raise ComposioIntegrationNotConnectedError("Composio integration not connected. Please authenticate first.")
composio.errors.ComposioIntegrationNotConnectedError: Composio integration not connected. Please authenticate first.
QUICK FIX
Set the COMPOSIO_API_KEY environment variable and call composio_client.connect() before sending events.

Why it happens

This error occurs when the Composio client attempts to send data or perform actions without a successful connection or authentication to the Composio service. It usually means the integration setup step was skipped or the API key was not provided or invalid.

Detection

Check for this exception immediately after initializing the Composio client or before sending events; log connection status and verify API key presence to catch it early.

Causes & fixes

1

API key environment variable is missing or not loaded

✓ Fix

Set the COMPOSIO_API_KEY environment variable before initializing the client and verify it is accessible in your runtime environment.

2

Client initialization code did not call the authentication or connect method

✓ Fix

Ensure you call composio_client.connect() or the equivalent authentication method before sending any events.

3

Using an invalid or expired API key causing authentication failure

✓ Fix

Verify your API key is valid and has not expired; regenerate it from the Composio dashboard if necessary.

Code: broken vs fixed

Broken - triggers the error
python
from composio import ComposioClient

client = ComposioClient()

# This line raises ComposioIntegrationNotConnectedError
client.send_event({'event': 'test'})
Fixed - works correctly
python
import os
from composio import ComposioClient

os.environ['COMPOSIO_API_KEY'] = 'your_api_key_here'  # Set your API key securely

client = ComposioClient()
client.connect()  # Authenticate and connect before sending events

client.send_event({'event': 'test'})
print('Event sent successfully')
Added environment variable for API key and called connect() method to authenticate before sending events, preventing the connection error.

Workaround

Wrap send_event calls in try/except ComposioIntegrationNotConnectedError, then log the error and retry client.connect() before resending the event.

Prevention

Always set and verify the COMPOSIO_API_KEY environment variable and call the client’s connect or authenticate method during app startup to ensure the integration is connected before use.

Python 3.7+ · composio >=1.0.0 · tested on 1.2.3
Verified 2026-04
Verify ↗

Community Notes

No notes yetBe the first to share a version-specific fix or tip.