crewAIInc/crewAI · error · ValueError

ZAPIER_API_KEY is not set

Error message

ZAPIER_API_KEY is not set

What it means

ZapierCrewAISource / the zapier tool factory needs an API key to fetch your exposed Zapier actions. It falls back to the ZAPIER_API_KEY environment variable when no argument is given; if both are missing it logs an error and raises ValueError('ZAPIER_API_KEY is not set').

Source

Thrown at lib/crewai-tools/src/crewai_tools/tools/zapier_action_tool/zapier_action_tool.py:26


def ZapierActionTools(  # noqa: N802
    zapier_api_key: str | None = None, action_list: list[str] | None = None
) -> list[ZapierActionTool]:
    """Factory function that returns Zapier action tools.

    Args:
        zapier_api_key: The API key for Zapier.
        action_list: Optional list of specific tool names to include.

    Returns:
        A list of Zapier action tools.
    """
    if zapier_api_key is None:
        zapier_api_key = os.getenv("ZAPIER_API_KEY")
        if zapier_api_key is None:
            logger.error("ZAPIER_API_KEY is not set")
            raise ValueError("ZAPIER_API_KEY is not set")
    adapter = ZapierActionsAdapter(zapier_api_key)
    all_tools = adapter.tools()

    if action_list is None:
        return all_tools

    return [tool for tool in all_tools if tool.name in action_list]

View on GitHub (pinned to 754d7323be)

Solutions

  1. Create a Zapier CrewAI integration key and export ZAPIER_API_KEY=... before running.
  2. Or pass it directly: ZapierCrewAISource(zapier_api_key='...').
  3. Call load_dotenv() at the entrypoint and assert the var exists to fail fast.

Example fix

# before
tools = ZapierCrewAISource()  # no arg, no env -> ValueError

# after
import os
from dotenv import load_dotenv
load_dotenv()
tools = ZapierCrewAISource(zapier_api_key=os.environ['ZAPIER_API_KEY'])
Defensive patterns

Strategy: validation

Validate before calling

import os

zapier_key = os.getenv('ZAPIER_API_KEY')
if not zapier_key:
    raise SystemExit('ZAPIER_API_KEY not set - create a Zapier CrewAI integration key')

Try / catch

try:
    tools = ZapierCrewAISource()
except ValueError as e:
    if 'ZAPIER_API_KEY' in str(e):
        raise SystemExit('Configure ZAPIER_API_KEY in your environment')
    raise

Prevention

When it happens

Trigger: Calling ZapierCrewAISource() (or the equivalent factory) without zapier_api_key=... while ZAPIER_API_KEY is unset or empty in the environment.

Common situations: New integrations where the Zapier MCP/key was never created; .env not loaded before the call; key set in the shell but not in the deploy environment; key name typo.

Related errors


AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15). Data as JSON: /api/errors/9f3a87936dc7806e. Report an issue: GitHub.