Skip to content

Response validation failed #29

@ybdesire

Description

@ybdesire

Is there any policy to skip the error?

[-] Response validation failed
Traceback (most recent call last):
  File "/home/aabc/projects/ttst/vulnhuntr/vulnhuntr/LLMs.py", line 45, in _validate_response
    return response_model.model_validate_json(response_text)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aabc/anaconda3/envs/xxtstenv/lib/python3.12/site-packages/pydantic/main.py", line 597, in model_validate_json
    return cls.__pydantic_validator__.validate_json(json_data, strict=strict, context=context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for Response
vulnerability_types.2
  Input should be 'LFI', 'RCE', 'SSRF', 'AFO', 'SQLI', 'XSS' or 'IDOR' [type=enum, input_value='DoS', input_type=str]
    For further information visit https://errors.pydantic.dev/2.8/v/enum
Traceback (most recent call last):
  File "/home/aabc/projects/ttst/vulnhuntr/vulnhuntr/LLMs.py", line 45, in _validate_response
    return response_model.model_validate_json(response_text)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aabc/anaconda3/envs/xxtstenv/lib/python3.12/site-packages/pydantic/main.py", line 597, in model_validate_json
    return cls.__pydantic_validator__.validate_json(json_data, strict=strict, context=context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for Response
vulnerability_types.2
  Input should be 'LFI', 'RCE', 'SSRF', 'AFO', 'SQLI', 'XSS' or 'IDOR' [type=enum, input_value='DoS', input_type=str]
    For further information visit https://errors.pydantic.dev/2.8/v/enum

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/aabc/projects/ttst/vulnhuntr/vulnhuntr/main.py", line 491, in <module>
    run()
  File "/home/aabc/projects/ttst/vulnhuntr/vulnhuntr/main.py", line 397, in run
    initial_analysis_report: Response = llm.chat(user_prompt, response_model=Response)
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aabc/projects/ttst/vulnhuntr/vulnhuntr/LLMs.py", line 75, in chat
    response_text = self._validate_response(response_text, response_model) if response_model else response_text
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aabc/projects/ttst/vulnhuntr/vulnhuntr/LLMs.py", line 48, in _validate_response
    raise LLMError("Validation failed") from e
LLMs.LLMError: Validation failed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions