{"record":{"id":"9f3a87936dc7806e","repo":"crewAIInc/crewAI","slug":"zapier-api-key-is-not-set","errorCode":null,"errorMessage":"ZAPIER_API_KEY is not set","messagePattern":"ZAPIER_API_KEY is not set","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/tools/zapier_action_tool/zapier_action_tool.py","lineNumber":26,"sourceCode":"\n\ndef ZapierActionTools(  # noqa: N802\n    zapier_api_key: str | None = None, action_list: list[str] | None = None\n) -> list[ZapierActionTool]:\n    \"\"\"Factory function that returns Zapier action tools.\n\n    Args:\n        zapier_api_key: The API key for Zapier.\n        action_list: Optional list of specific tool names to include.\n\n    Returns:\n        A list of Zapier action tools.\n    \"\"\"\n    if zapier_api_key is None:\n        zapier_api_key = os.getenv(\"ZAPIER_API_KEY\")\n        if zapier_api_key is None:\n            logger.error(\"ZAPIER_API_KEY is not set\")\n            raise ValueError(\"ZAPIER_API_KEY is not set\")\n    adapter = ZapierActionsAdapter(zapier_api_key)\n    all_tools = adapter.tools()\n\n    if action_list is None:\n        return all_tools\n\n    return [tool for tool in all_tools if tool.name in action_list]\n","sourceCodeStart":8,"sourceCodeEnd":34,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/zapier_action_tool/zapier_action_tool.py#L8-L34","documentation":"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').","triggerScenarios":"Calling ZapierCrewAISource() (or the equivalent factory) without zapier_api_key=... while ZAPIER_API_KEY is unset or empty in the environment.","commonSituations":"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.","solutions":["Create a Zapier CrewAI integration key and export ZAPIER_API_KEY=... before running.","Or pass it directly: ZapierCrewAISource(zapier_api_key='...').","Call load_dotenv() at the entrypoint and assert the var exists to fail fast."],"exampleFix":"# before\ntools = ZapierCrewAISource()  # no arg, no env -> ValueError\n\n# after\nimport os\nfrom dotenv import load_dotenv\nload_dotenv()\ntools = ZapierCrewAISource(zapier_api_key=os.environ['ZAPIER_API_KEY'])","handlingStrategy":"validation","validationCode":"import os\n\nzapier_key = os.getenv('ZAPIER_API_KEY')\nif not zapier_key:\n    raise SystemExit('ZAPIER_API_KEY not set - create a Zapier CrewAI integration key')","typeGuard":null,"tryCatchPattern":"try:\n    tools = ZapierCrewAISource()\nexcept ValueError as e:\n    if 'ZAPIER_API_KEY' in str(e):\n        raise SystemExit('Configure ZAPIER_API_KEY in your environment')\n    raise","preventionTips":["Create the Zapier key first, store it in .env/secrets, and load it before building tools.","Pass zapier_api_key explicitly instead of relying on env fallback.","Assert required integration keys at startup for every external service your crew uses."],"tags":["configuration","api-key","environment","zapier"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}