Skip to content

fix(serpapi): guard organic_results shape and rows - #2006

Open
Bartok9 wants to merge 1 commit into
assafelovic:mainfrom
Bartok9:fix/serpapi-organic-results-guards
Open

fix(serpapi): guard organic_results shape and rows#2006
Bartok9 wants to merge 1 commit into
assafelovic:mainfrom
Bartok9:fix/serpapi-organic-results-guards

Conversation

@Bartok9

@Bartok9 Bartok9 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

SerpApi organic_results is assumed to be a list of dicts. Non-list payloads and non-dict rows raised during normalize and dropped the full result set.

Motivation

Malformed or error-shaped API JSON should not crash search.

Verification

python -m pytest tests/retrievers/test_serpapi_organic_guards.py -q
# 2 passed

Real proof: non-list organic_results[]; mixed rows keep only valid links (YouTube skipped).

Skip non-list organic_results payloads and non-dict rows so a malformed
SerpApi response cannot AttributeError the whole search.
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.

1 participant