crewAIInc/crewAI · error · SystemExit
Missing required input '{name}'{suffix}
Error message
Missing required input '{name}'{suffix} What it means
Input validation for declarative flows: after merging defaults (from the definition) with interactively collected or passed inputs, _missing_required() found required state fields still absent. Each missing field is printed in red, with the field's schema `description` appended as a hint when present, then the CLI exits 1 before the flow starts.
Source
Thrown at lib/cli/src/crewai_cli/run_declarative_flow.py:322
collected.update(
prompt_for_inputs(
missing,
title="Flow inputs",
subtitle="This flow needs the following to run.",
describe=lambda name: (properties.get(name) or {}).get("description"),
coerce=lambda name, raw: _coerce_input(raw, properties.get(name) or {}),
)
)
missing = _missing_required(state_model, {**defaults, **collected})
if missing:
for name in missing:
description = (properties.get(name) or {}).get("description")
suffix = f" — {description}" if description else ""
click.secho(
f" Missing required input '{name}'{suffix}", fg="red", err=True
)
raise SystemExit(1)
_validate_flow_inputs(state_model, {**defaults, **collected})
return collected
def _is_interactive() -> bool:
"""Prompt only in an interactive terminal, never in non-interactive mode."""
return is_interactive()
def _flow_state_schema(flow: Any) -> dict[str, Any] | None:
"""Return the flow's state JSON schema, or ``None`` for dict/plain state."""
state = getattr(flow, "state", None)
if state is None or isinstance(state, dict):
return None
model_json_schema = getattr(type(state), "model_json_schema", None)
if not callable(model_json_schema):
return NoneView on GitHub (pinned to 754d7323be)
Solutions
- Supply each listed field via the flow's inputs mechanism (command flags or inputs file) with the exact field name.
- In interactive mode, answer the prompts for those fields instead of skipping them.
- If a field should be optional, give it a default value in the flow's state model (pydantic default or default_factory).
- Check the appended description in the error line for the expected format/meaning of the field.
Example fix
# before
# state: class FlowState(BaseModel): topic: str # required
$ crewai flow run # non-interactive, no topic given
# Missing required input 'topic' — The research topic
# after
$ crewai flow run --inputs '{"topic": "quantum computing"}'
# or make it optional in the state model:
class FlowState(BaseModel):
topic: str = "general" Defensive patterns
Strategy: validation
Validate before calling
from crewai_cli.run_declarative_flow import _missing_required
schema = _flow_state_schema(flow) # or build the state model directly
required = {k for k, v in (schema or {}).get("properties", {}).items()
if k in (schema or {}).get("required", [])}
provided = {**defaults, **collected}
missing = required - provided.keys()
if missing:
raise SystemExit(f"missing required flow inputs: {sorted(missing)}") Prevention
- Give every state field a default unless it is genuinely required, so automated runs never stall.
- In scripts, pass inputs explicitly as JSON instead of relying on interactive prompts.
- Use the field `description` in the state model — the CLI surfaces it in this exact error.
When it happens
Trigger: Running a declarative flow whose state model has required fields (no default) that are not covered by: --inputs values, prompted answers in interactive mode, or defaults declared in the definition. Required fields with `default_factory` or defaults are never reported.
Common situations: Team shares a flow definition whose state model gained new required fields; non-interactive runs skipping prompts so required inputs are silently absent; typos in input keys versus state field names.
Related errors
- Invalid input '{location}': {error.get('msg')}
- Unable to read --definition path {definition_path}: {exc}
- Invalid --inputs JSON: {exc}
- Invalid --inputs JSON: expected an object.
- Missing required input '{name}'
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/6728aaf2fa6aac9c.
Report an issue: GitHub.