Skip to content

fix(github): handle 422 search errors in Dependency-Update-Tool#4978

Open
LoveChauhan-18 wants to merge 2 commits intoossf:mainfrom
LoveChauhan-18:fix/issue-4352
Open

fix(github): handle 422 search errors in Dependency-Update-Tool#4978
LoveChauhan-18 wants to merge 2 commits intoossf:mainfrom
LoveChauhan-18:fix/issue-4352

Conversation

@LoveChauhan-18
Copy link
Copy Markdown

PR Description

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

The Dependency-Update-Tool check currently returns a "check runtime error" (internal error) if the GitHub Search API returns a 422 Validation Failed status. This is a known issue for some public repositories that have not yet been indexed by GitHub's search engine, which shouldn't cause the entire Scorecard check to fail.

What is the new behavior (if this is a feature change)?**

I've updated the searchCommitsHandler to catch 422 errors (Unprocessable Entity) specifically. Instead of returning an error, it now returns an empty list of commits. This allows the check to finish gracefully (using other indicators like the dependabot.yml file) and prevents a hard failure due to search indexing issues.

I also fixed a small typo in the error message where it was referencing Search.Code instead of Search.Commits.

  • Tests for the changes have been added (for bug fixes/features)

Which issue(s) this PR fixes

Fixes #4352

Special notes for your reviewer

Verified this with a new unit test TestSearchCommitsHandle422 which mocks the 422 response from GitHub.

Does this PR introduce a user-facing change?

NONE

NONE

@LoveChauhan-18 LoveChauhan-18 requested a review from a team as a code owner March 24, 2026 19:13
@LoveChauhan-18 LoveChauhan-18 requested review from AdamKorcz and spencerschrock and removed request for a team March 24, 2026 19:13
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Mar 24, 2026
…exts

Signed-off-by: Love Kumar Chauhan <lovechauhan6564@gmail.com>
The GitHub Search API can return a 422 Validation Failed error for
public repositories that are not yet indexed. This was causing an
internal error in Scorecard's Dependency-Update-Tool check.

This fix catches the 422 error and returns an empty list of commits,
allowing the check to proceed without a hard failure.

Fixes ossf#4352

Signed-off-by: Love Kumar Chauhan <lovechauhan6564@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Public GH repo is getting 422 Validation Failed

1 participant