Skip to content

fix: handle __404__ sentinel in github-dockerfile-discovery#25

Merged
locus313 merged 1 commit into
mainfrom
fix/gh-api-sentinel-handling
Jun 26, 2026
Merged

fix: handle __404__ sentinel in github-dockerfile-discovery#25
locus313 merged 1 commit into
mainfrom
fix/gh-api-sentinel-handling

Conversation

@locus313

Copy link
Copy Markdown
Owner

Summary

Two places in github-dockerfile-discovery.sh called lib's gh_api but didn't handle the __404__ sentinel value, introduced alongside __422__ in the dual-auth refactor.

Changes

enterprise/github-dockerfile-discovery/github-dockerfile-discovery.sh

  • search_org_dockerfiles: added __404__ to the existing __422__ guard — orgs that return 404 for code search are now skipped cleanly with a warning instead of crashing on jq trying to parse __404__ as JSON
  • fetch_dockerfile_content: added __404__ and __422__ to the empty-string guard — avoids a misleading Unexpected encoding '__404__' warning when a file path is not found

github-get-public-repos already handles all three cases (__404__, __422__, empty) — no change needed there.

Root cause

The gh_api library helper returns string sentinels __404__ and __422__ instead of non-zero exit codes. Any caller that only checks for empty string or only checks for __422__ will silently pass the sentinel to jq, which either errors or produces unexpected output.

- search_org_dockerfiles: add __404__ to the existing __422__ guard so
  orgs with no code-search access are skipped cleanly instead of trying
  to jq-parse the sentinel string
- fetch_dockerfile_content: check for __404__ and __422__ alongside the
  empty-string guard to avoid a misleading 'Unexpected encoding' warning
  when a file is not found

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@locus313 locus313 merged commit 6ab08f1 into main Jun 26, 2026
1 check passed
@locus313 locus313 deleted the fix/gh-api-sentinel-handling branch June 26, 2026 21:17
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