Skip to content

Fix uncaught pydantic ValidationError crash on malformed LLM response#255

Open
Ruanyuxi1337 wants to merge 1 commit into
NVIDIA:mainfrom
Ruanyuxi1337:fix-validation-error-crash
Open

Fix uncaught pydantic ValidationError crash on malformed LLM response#255
Ruanyuxi1337 wants to merge 1 commit into
NVIDIA:mainfrom
Ruanyuxi1337:fix-validation-error-crash

Conversation

@Ruanyuxi1337

Copy link
Copy Markdown

Fixes #250. Wraps the per-batch LLM request and parse loop in a try-except guard. If a parsing or network validation failure occurs, it warns, retries exactly once, and falls back gracefully, preventing the entire scan from crashing and losing all report progress.

@koriyoshi2041

Copy link
Copy Markdown

Thanks for taking this on. One gap worth covering before merge: this only wraps the async arun_batches() path, but semantic_security_discovery still calls analyzer.run_batches(batches).

In that sync loop, a malformed structured response from one batch still raises out of run_batches; the outer node catch then returns zero findings for the whole semantic analyzer, including any earlier batches that parsed successfully. A focused regression would be: three sync batches, middle one raises a Pydantic ValidationError from LLMAnalysisResult.model_validate(...), and the first/third batch results are still returned.

So I think the same per-batch isolation should be added to run_batches() too, otherwise #250 can still reproduce through that analyzer path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Single malformed LLM response aborts the entire scan (uncaught pydantic ValidationError) — triggered consistently by the default nv_build model

2 participants