Repository navigation
exit 8 when Common Crawl cannot be reached - #132
Merged
Merged
Conversation
The help lists exit 8 as "transport failure, the bytes did not arrive". One command returned it. cli/download.go was the only errs.KindNetwork in the tree, so every other command that could not reach Common Crawl exited 1, which is the code for anything at all. index.commoncrawl.org has been refusing connections for two days, so this was easy to see: crawls latest, search, and get all exited 1 with "connect: connection refused", indistinguishable from a bad crawl ID. The retry loop in ccrawl/client.go now marks its exhaustion with ErrTransport when the last failure came from the transport rather than from a status the server sent, and cli classifies that as errs.KindNetwork. An exhausted 503 stays exit 1: the server was there and said no, and telling a supervisor otherwise sends it into a loop against a source that is up and refusing. errs.KindOf walks the error chain, so classifying once at the point the transport gives up reaches the CLI, HTTP, and MCP surfaces together. It is applied where commands are registered rather than in 34 handlers: handle over kit.Handle, addCmd and addCmdUnder over AddCommand and AddCommandUnder, which walk the Sub tree. TestEveryHandlerIsClassified walks the source and fails on a registration that goes around them, since kit builds its cobra tree privately and a test cannot ask the binary what it registered. Measured against the live outage: crawls latest 8 connect: connection refused crawls list 8 connect: connection refused search example.com/* 8 connect: connection refused get example.com 8 connect: connection refused paths bogus 8 connect: connection refused rank host 2 expected at least 1 argument rank top --graph nope-2020 1 Rank table HTTP 404 download -n 1 --source s3 8 no AWS credentials rank host wikipedia.org 0 paths warc -c CC-MAIN-2025-05 0 Closes #131
34 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #131.
The help lists exit 8 as "transport failure, the bytes did not arrive". One command returned it.
cli/download.go:157was the onlyerrs.KindNetworkin the tree, so every other command that could not reach Common Crawl exited 1, which is the code for anything at all.index.commoncrawl.orghas been refusing connections for two days, so this was easy to see:crawls latest,search, andgetall exited 1 with "connect: connection refused", indistinguishable from a bad crawl ID or a malformed pattern.The change
The retry loop in
ccrawl/client.gomarks its exhaustion withErrTransportwhen the last failure came from the transport rather than from a status the server sent.cliclassifies that aserrs.KindNetwork.An exhausted 503 stays exit 1. The server was there and said no, and telling a supervisor otherwise sends it into a loop against a source that is up and refusing.
errs.KindOfwalks the error chain, so classifying once at the point the transport gives up reaches the CLI, HTTP, and MCP surfaces together.ccrawlstill does not import the framework: it exports a plain sentinel andclidoes the classifying.It is applied where commands are registered rather than in 34 handlers:
handleoverkit.Handle, andaddCmd/addCmdUnderoverAddCommand/AddCommandUnder, which walk theSubtree.TestEveryHandlerIsClassifiedwalks the source and fails on a registration that goes around them, since kit builds its cobra tree privately and a test cannot ask the binary what it registered. It counts 53 classified registrations today.Measured against the live outage
crawls latestcrawls listsearch example.com/*get example.compaths bogusrank hostrank top --graph nope-2020 -n 1download warc -n 1 --source s3rank host wikipedia.orgpaths warc -c CC-MAIN-2025-05Before the change the first five were all 1.
The two unit tests on the
ccrawlside use a closed port and a permanent 503 rather than the outage, so they keep working once Common Crawl comes back.Docs
The exit codes reference named
downloadas the only source of 8. It now describes what 8 means for every command, shows the outage as it looks from the shell, and carries a supervisor snippet that backs off on 8 and stops on anything else. The one thing that stays scoped todownloadis that it reports any download failure as a transport failure,--source s3without credentials included.Checks
gofmt,go vet,go test ./...,golangci-lint(0 issues),scripts/docs-drift.sh,scripts/coverage.shall clean. cli coverage 52.4 to 52.6.