{"record":{"id":"6728aaf2fa6aac9c","repo":"crewAIInc/crewAI","slug":"missing-required-input-name-suffix","errorCode":null,"errorMessage":"Missing required input '{name}'{suffix}","messagePattern":"Missing required input '(.+?)'(.+?)","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"lib/cli/src/crewai_cli/run_declarative_flow.py","lineNumber":322,"sourceCode":"        collected.update(\n            prompt_for_inputs(\n                missing,\n                title=\"Flow inputs\",\n                subtitle=\"This flow needs the following to run.\",\n                describe=lambda name: (properties.get(name) or {}).get(\"description\"),\n                coerce=lambda name, raw: _coerce_input(raw, properties.get(name) or {}),\n            )\n        )\n        missing = _missing_required(state_model, {**defaults, **collected})\n\n    if missing:\n        for name in missing:\n            description = (properties.get(name) or {}).get(\"description\")\n            suffix = f\" — {description}\" if description else \"\"\n            click.secho(\n                f\"  Missing required input '{name}'{suffix}\", fg=\"red\", err=True\n            )\n        raise SystemExit(1)\n\n    _validate_flow_inputs(state_model, {**defaults, **collected})\n    return collected\n\n\ndef _is_interactive() -> bool:\n    \"\"\"Prompt only in an interactive terminal, never in non-interactive mode.\"\"\"\n    return is_interactive()\n\n\ndef _flow_state_schema(flow: Any) -> dict[str, Any] | None:\n    \"\"\"Return the flow's state JSON schema, or ``None`` for dict/plain state.\"\"\"\n    state = getattr(flow, \"state\", None)\n    if state is None or isinstance(state, dict):\n        return None\n    model_json_schema = getattr(type(state), \"model_json_schema\", None)\n    if not callable(model_json_schema):\n        return None","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/cli/src/crewai_cli/run_declarative_flow.py#L304-L340","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\n# state: class FlowState(BaseModel): topic: str  # required\n$ crewai flow run  # non-interactive, no topic given\n#   Missing required input 'topic' — The research topic\n\n# after\n$ crewai flow run --inputs '{\"topic\": \"quantum computing\"}'\n\n# or make it optional in the state model:\nclass FlowState(BaseModel):\n    topic: str = \"general\"","handlingStrategy":"validation","validationCode":"from crewai_cli.run_declarative_flow import _missing_required\n\nschema = _flow_state_schema(flow)  # or build the state model directly\nrequired = {k for k, v in (schema or {}).get(\"properties\", {}).items()\n            if k in (schema or {}).get(\"required\", [])}\nprovided = {**defaults, **collected}\nmissing = required - provided.keys()\nif missing:\n    raise SystemExit(f\"missing required flow inputs: {sorted(missing)}\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["validation","flow","declarative","inputs","pydantic"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}