crewAIInc/crewAI · error · ValueError
Zapier Actions API key is required
Error message
Zapier Actions API key is required
What it means
Raised by ZapierActionsAdapter.__init__ when neither the `api_key` argument nor the ZAPIER_API_KEY environment variable yields a non-empty key. It is a hard configuration gate: without a key, no Zapier Actions API call can be authenticated.
Source
Thrown at lib/crewai-tools/src/crewai_tools/adapters/zapier_adapter.py:65
execute_url,
headers=headers,
json=action_params,
timeout=30,
)
response.raise_for_status()
return response.json()
class ZapierActionsAdapter:
"""Adapter for Zapier Actions."""
def __init__(self, api_key: str | None = None):
self.api_key = api_key or os.getenv("ZAPIER_API_KEY")
if not self.api_key:
logger.error("Zapier Actions API key is required")
raise ValueError("Zapier Actions API key is required")
def get_zapier_actions(self) -> Any:
headers = {
"x-api-key": self.api_key or "",
}
response = requests.request(
"GET",
ACTIONS_URL,
headers=headers,
timeout=30,
)
response.raise_for_status()
return response.json()
def tools(self) -> list[ZapierActionTool]:
"""Convert Zapier actions to BaseTool instances."""
actions_response = self.get_zapier_actions()View on GitHub (pinned to 754d7323be)
Solutions
- Export the key before running: `export ZAPIER_API_KEY=your_key` (or add it to your .env and ensure it is loaded).
- Pass it explicitly: `ZapierActionsAdapter(api_key='your_key')`.
- In CI/deployment, add ZAPIER_API_KEY as a secret env var on the runner.
- Verify with `echo ${ZAPIER_API_KEY:-unset}` that the variable actually reaches the process.
Example fix
# before adapter = ZapierActionsAdapter() # ValueError if env var missing # after adapter = ZapierActionsAdapter(api_key=os.environ["ZAPIER_API_KEY"]) # fails fast with KeyError if truly missing # or export ZAPIER_API_KEY=your_key
Defensive patterns
Strategy: validation
Validate before calling
import os
api_key = os.getenv("ZAPIER_API_KEY")
if not api_key:
raise SystemExit("ZAPIER_API_KEY is not set — get one at https://zapier.com/appconnections/ai")
adapter = ZapierActionsAdapter(api_key) Type guard
def has_zapier_key() -> bool:
return bool(os.getenv("ZAPIER_API_KEY")) Try / catch
try:
adapter = ZapierActionsAdapter()
except ValueError as e:
if "API key" in str(e):
raise SystemExit("Set ZAPIER_API_KEY in the environment") from e
raise Prevention
- Fail fast on startup: check os.getenv('ZAPIER_API_KEY') before building agents.
- Store the key in a secrets manager and inject it as an env var in CI/deploy.
- Pass api_key explicitly in scripts instead of relying on ambient env.
When it happens
Trigger: Instantiating ZapierActionsAdapter() with no argument while ZAPIER_API_KEY is unset or empty, or passing an empty string api_key explicitly (`api_key=''` falls through to env lookup, which is also empty).
Common situations: Forgot to export ZAPIER_API_KEY in the shell/CI environment, .env file not loaded into the process, key set in a different deployment environment, or a copy-pasted snippet that expects the env var at runtime.
Related errors
- Authentication not configured
- API key must be provided either through constructor or MINDS
- APIFY_API_TOKEN environment variable is not set. Please set
- BRAVE_API_KEY environment variable is required
- No platform integration token found, please set the CREWAI_P
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/f3b31097cb92c3dc.
Report an issue: GitHub.