crewAIInc/crewAI · error · SystemExit
Error executing crew with trigger: {e}
Error message
Error executing crew with trigger: {e} What it means
Printed with SystemExit(1) by TriggerCommand.execute_with_trigger() as the outer catch-all: any exception after the 404 check — _validate_response failures (auth/5xx), JSON decode errors on the response, or failures inside _run_crew_with_payload when spawning the local crew process with the sample payload — surfaces as 'Error executing crew with trigger: {e}'.
Source
Thrown at lib/cli/src/crewai_cli/triggers/main.py:71
if response.status_code == 404:
error_data = response.json()
console.print(
f"[bold red]Error: {error_data.get('error', 'Trigger not found')}[/bold red]"
)
raise SystemExit(1)
self._validate_response(response)
trigger_data = response.json()
self._display_trigger_info(trigger_data)
self._run_crew_with_payload(trigger_data.get("sample_payload", {}))
except Exception as e:
console.print(
f"[bold red]Error executing crew with trigger: {e}[/bold red]"
)
raise SystemExit(1) from e
def _display_triggers(self, triggers_data: dict[str, Any]) -> None:
"""Display triggers in a formatted table."""
apps = triggers_data.get("apps", [])
if not apps:
console.print("[yellow]No triggers found.[/yellow]")
return
for app in apps:
app_name = app.get("name", "Unknown App")
app_slug = app.get("slug", "unknown")
is_connected = app.get("is_connected", False)
connection_status = (
"[green]✓ Connected[/green]"
if is_connected
else "[red]✗ Not Connected[/red]"
)View on GitHub (pinned to 754d7323be)
Solutions
- Read the inner exception text after the colon — it distinguishes API errors from local crew execution failures.
- For API auth errors, re-run `crewai login` and retry.
- For local crew failures, first make a plain `crewai run` work, then retry `crewai trigger execute app/trigger`.
- Ensure the project was scaffolded with trigger support (main.py contains run_with_trigger) and is up to date (`crewai update` or re-scaffold).
Defensive patterns
Strategy: try-catch
Validate before calling
# validate auth + local runnability before executing a trigger assert auth.get_api_key(), "run `crewai login` first" import subprocess assert subprocess.run(["uv", "run", "run"], capture_output=True).returncode == 0, "plain `crewai run` must succeed first"
Try / catch
try:
cmd.execute_with_trigger(trigger_path)
except SystemExit:
raise
except Exception as e:
# read inner text: API auth/5xx vs local crew subprocess failure
logging.exception("trigger execution failed: %s", e)
raise Prevention
- Get `crewai run` green before wiring triggers
- Keep the Plus token fresh; re-login on 401s
- Scaffold with trigger-capable templates and keep the CLI/crewai versions in sync
When it happens
Trigger: Plus API returns 401/500 for get_trigger_payload (non-404 error statuses); response body is not JSON; or the local crew run (`run_with_trigger` subprocess with the sample payload) fails — e.g. missing API keys for the crew itself, or the generated main.py lacking a run_with_trigger entrypoint.
Common situations: Expired Plus token mid-session; crew project not created from a template that supports triggers, so executing the payload locally crashes; crew env vars missing so the subprocess exits non-zero.
Related errors
- An error occurred while running the crew with trigger: {e}
- An error occurred while running the flow with trigger: {e}
- Error fetching triggers: {e}
- An error occurred while running the crew: {e}
- No trigger payload provided. Please provide JSON payload as
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/86537bdf8da4d585.
Report an issue: GitHub.