-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Labels
bugSomething isn't workingSomething isn't working
Description
Description
CrewAI Pydantic Validation Errors ⚠️
ERROR:root:Failed to parse structured output from stream: 1 validation error for TaskEvaluation
quality
Field required [type=missing, input_value={...}]
Root Cause: This is a CrewAI 1.4.1 bug where the LLM output doesn't match the expected Pydantic schema for memory storage. This doesn't break functionality - it just fails to save that specific
memory entry to long-term storage.
Bug Description
CrewAI 1.4.1 fails to add memories to long-term storage due to Pydantic validation errors in TaskEvaluation schema.
Error Message
ERROR:root:Failed to parse structured output from stream: 1 validation error for TaskEvaluation
quality
Field required [type=missing, input_value={'suggestions': [...]}]
Impact
- Non-critical: Agent execution continues
- Long-term memory accumulation is reduced
- Some task insights are lost
Steps to Reproduce
Steps to Reproduce
- Create a Crew with
memory=Trueandexternal_memory=ExternalMemory(...) - Run any task with an agent
- After task completion, CrewAI attempts to save memory
- LLM output doesn't match expected Pydantic schema
- Memory save fails with validation error
Expected behavior
Expected Behavior
CrewAI should successfully parse LLM output and save task evaluations to long-term memory without validation errors.
Actual Behavior
- TaskEvaluation schema expects
qualityfield - LLM output omits
qualityfield - Pydantic validation fails
- Memory is not saved
- Error logged but doesn't break execution
Screenshots/Code snippets
synapse_celery_worker | [2025-11-14 12:02:42,338: ERROR/ForkPoolWorker-2] Failed to parse structured output from stream: 7 validation errors for TaskEvaluation
synapse_celery_worker | suggestions.0
synapse_celery_worker | Input should be a valid string [type=string_type, input_value={'point': 'Proceed immedi...e.', 'priority': 'high'}, input_type=dict]
synapse_celery_worker | For further information visit https://errors.pydantic.dev/2.12/v/string_type
synapse_celery_worker | suggestions.1
synapse_celery_worker | Input should be a valid string [type=string_type, input_value={'point': 'When asking fo...', 'priority': 'medium'}, input_type=dict]
synapse_celery_worker | For further information visit https://errors.pydantic.dev/2.12/v/string_type
synapse_celery_worker | suggestions.2
synapse_celery_worker | Input should be a valid string [type=string_type, input_value={'point': 'Use markdown f...', 'priority': 'medium'}, input_type=dict]
synapse_celery_worker | For further information visit https://errors.pydantic.dev/2.12/v/string_type
synapse_celery_worker | suggestions.3
synapse_celery_worker | Input should be a valid string [type=string_type, input_value={'point': 'After collecti...s.', 'priority': 'high'}, input_type=dict]
synapse_celery_worker | For further information visit https://errors.pydantic.dev/2.12/v/string_type
synapse_celery_worker | suggestions.4
synapse_celery_worker | Input should be a valid string [type=string_type, input_value={'point': 'Once the final...y.', 'priority': 'high'}, input_type=dict]
synapse_celery_worker | For further information visit https://errors.pydantic.dev/2.12/v/string_type
synapse_celery_worker | suggestions.5
synapse_celery_worker | Input should be a valid string [type=string_type, input_value={'point': 'End with a cle...', 'priority': 'medium'}, input_type=dict]
synapse_celery_worker | For further information visit https://errors.pydantic.dev/2.12/v/string_type
synapse_celery_worker | quality
synapse_celery_worker | Field required [type=missing, input_value={'suggestions': [{'point'..., 'relationships': []}]}, input_type=dict]
synapse_celery_worker | For further information visit https://errors.pydantic.dev/2.12/v/missing
synapse_app | WARNING: WatchFiles detected changes in 'src/agents/module_name/crew.py'. Reloading...
synapse_app | INFO: Shutting down
synapse_app | INFO: Waiting for application shutdown.
synapse_app | 2025-11-14 12:02:48 | INFO | src.main:lifespan:31 - Shutting down Synapse API
synapse_app | INFO: Application shutdown complete.
synapse_app | INFO: Finished server process [13]
synapse_app | WARNING: WatchFiles detected changes in 'src/agents/module_name/crew.py'. Reloading...
synapse_celery_worker | [2025-11-14 12:02:54,367: ERROR/ForkPoolWorker-2] Failed to parse structured output from stream: 1 validation error for TaskEvaluation
synapse_celery_worker | quality
synapse_celery_worker | Field required [type=missing, input_value={'suggestions': ['Complet...ships': ['suggested']}]}, input_type=dict]
synapse_celery_worker | For further information visit https://errors.pydantic.dev/2.12/v/missing
synapse_app | 2025-11-14 12:02:57 | INFO | src.core.logger:setup_logging:82 - 🔧 Development mode: Console logging enabled
synapse_app | INFO: Started server process [16]
synapse_app | INFO: Waiting for application startup.
synapse_app | 2025-11-14 12:03:01 | INFO | src.main:lifespan:16 - Starting Synapse API | environment=development
synapse_app | INFO: Application startup complete.
synapse_celery_worker | [2025-11-14 12:03:09,228: ERROR/ForkPoolWorker-2] Failed to parse structured output from stream: 1 validation error for TaskEvaluation
synapse_celery_worker | quality
synapse_celery_worker | Field required [type=missing, input_value={'score': 3, 'suggestions...esponsibility zones']}]}, input_type=dict]
synapse_celery_worker | For further information visit https://errors.pydantic.dev/2.12/v/missing
synapse_celery_worker | [2025-11-14 12:03:09,249: WARNING/ForkPoolWorker-2]
synapse_celery_worker | [2025-11-14 12:03:09][ERROR]: Failed to add to long term memory: Failed to convert text into a Pydantic model due to validation error: 1 validation error for TaskEvaluation
synapse_celery_worker | quality
synapse_celery_worker | Field required [type=missing, input_value={'score': 3, 'suggestions...esponsibility zones']}]}, input_type=dict]
synapse_celery_worker | For further information visit https://errors.pydantic.dev/2.12/v/missing
synapse_celery_worker | [2025-11-14 12:03:09,305: WARNING/ForkPoolWorker-2] 🚀 Crew: crew
synapse_celery_worker | ├── 📋 Task: 09c343f5-244d-4132-ae94-e8969f6c6eae
synapse_celery_worker | │ Assigned to: Task Execution Planner
synapse_celery_worker | │ Status: ✅ Completed
synapse_celery_worker | └── 📋 Task: c66e3901-e178-437c-9883-f058936b0491
synapse_celery_worker | Assigned to: Metrix Agent
synapse_celery_worker | Status: ✅ Completed
synapse_celery_worker | └── 🧠 Memory Update Overall
synapse_celery_worker | └── ✅ Short Term Memory Memory Saved (3871.03ms)
Operating System
Ubuntu 20.04
Python Version
3.11
crewAI Version
1.4.1
crewAI Tools Version
1.4.1
Virtual Environment
Venv
Evidence
Possible Solution
Additional Context
This appears to be a schema mismatch between what the LLM generates and what TaskEvaluation Pydantic model expects. The error occurs during structured output parsing from the LLM stream.
Suggested Fix
Either:
- Make
qualityfield optional in TaskEvaluation model - Improve prompt to ensure LLM always includes
quality - Add fallback/default value when field is missing
Additional context
Environment
- CrewAI version: 1.4.1
- Python version: 3.11
- LLM: OpenAI GPT-4o
- Memory backend: Mem0 + Qdrant
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working