Validation error for TaskOutput

Hello, I’m trying to get structured outputs, but I’m having trouble.

Problem Description

I’m encountering a persistent validation error in my CrewAI implementation when processing agent outputs through Pydantic. The task requires an agent (“Glancy”) to analyze missing requirements and output a JSON object matching this model:

class requirements_model(BaseModel):
    isComplete: str = Field(description="Boolean indicating requirement completeness")
    requirements: str = Field(description="Analysis of missing requirements")

Observed Failure

The task consistently fails with this validation error:

ValidationError: 1 validation error for TaskOutput
json_dict
  Input should be a valid dictionary [type=dict_type, input_value='{...}', input_type=str]

Key Details

  1. Agent Output: Appears as valid JSON string:
# Agent: Interpret Agent
## Final Answer:
I am an Interpret Agent. My precision and attention to detail are unmatched,   
and my ability to understand and interpret complex information is unparalleled.
Based on the provided code and test results, I have determined that the final  
answer should be in JSON format with two keys: "isComplete" and "requirements".
Here is the final answer:

{
  "isComplete": "true",
  "requirements": [
    {
      "name": "Gearbox_fsm_type",
      "type": "enum",
      "values": ["First", "Second", "Third", "Fourth"]
    },
    {
      "name": "input",
      "type": "struct",
      "fields": ["In_speed", "In_Throttle"]
    },
    {
      "name": "output",
      "type": "struct",
      "fields": ["Out_gear"]
    },
    {
      "name": "internal",
      "type": "struct",
      "fields": ["fsm_var"]
    }
  ]
}

I have thoroughly reviewed the provided code and test results to ensure that myfinal answer is accurate and complete. I am confident that this answer meets   
all requirements and will be accepted.
  1. CrewAI Configuration:
#### TASKS .yaml
interpret_missing_requirements:
  description: >
    Your task is to draft a detailed report based on the missing requeriments you found in:
    {missing_requirements}

    Take into account the last generated code:
    {generated_code}

    If you do your BEST WORK, you'll earn a $10,000 commission!
  expected_output: >
   A JSON object with a 2 keys: isComplete and requirements.
  agent: Glancy

#### CREW .py
@task
def interpret_missing_requirements(self) -> Task:
    return Task(
        config=self.tasks_config['interpret_missing_requirements'],
        output_json=requirements_model,
    )

What am I doing erroneously?

Thanks in advance!

same error for me too. please help me to resolve this.

pydantic_core._pydantic_core.ValidationError: 1 validation error for TaskOutput
json_dict
  Input should be a valid dictionary [type=dict_type, input_value=' ```json\n{\n  "normal_a...認する。"\n}\n```', input_type=str]
For further information visit https://errors.pydantic.dev/2.11/v/dict_type
An error occurred while running the flow: Command '['uv', 'run', 'kickoff']' returned non-zero exit status 1.

I am also facing the same issue. when i asked model to generate long json.

As per my understanding it is throwing this because at the generation time tokens limit exceed which result in incomplete json, which behave as a string and pydantic validation fails for string inputs.

But i am struggling to overcome this issue.

I am trying to call that agent again with the last output and the context to start generating that json where it left off.

If anyone can help me in that or any other suggestion would also help.

Thanks in advance