Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing exit 2, although no error visible #1477

Closed
guettli opened this issue Aug 6, 2024 · 6 comments
Closed

Confusing exit 2, although no error visible #1477

guettli opened this issue Aug 6, 2024 · 6 comments

Comments

@guettli
Copy link

guettli commented Aug 6, 2024

We get exit status 2, although no error is visible:

lychee --config .lychee.toml ./*.md  ./docs/**/*.md
  110/110 ━━━━━━━━━━━━━━━━━━━━ Finished extracting links
🔍 110 Total (in 9s) ✅ 96 OK 🚫 0 Errors 💤 13 Excluded

Exit 2

Version: 0.15.1

If you look carefully: 96+13 = 109, but 110 were processed.

With --verbose I found the issue:

? [999] https://www.linkedin.com/company/example.com/ | Unknown status (999 <unknown status code>)

Please provide a better error message in the future. It took us some time to find the root cause.

Nevertheless, thank you very much for Lychee!

@thomas-zahner
Copy link
Member

Thanks for reporting. The result lychee outputs by default if non-standard status codes are encountered may indeed be counterintuitive. If you use a different format (--format) it gets clearer as it shows up as unknown:

$ echo "https://httpstat.us/999" | lychee --format detailed -

📝 Summary
---------------------
🔍 Total............1
✅ Successful.......0
⏳ Timeouts.........0
🔀 Redirected.......0
👻 Excluded.........0
❓ Unknown..........1
🚫 Errors...........0

999 is not an accepted status code by default, but you could change that with --accept 999
So as explained in the README.md the exit code is correct behaviour:

2 for link check failures (if any non-excluded link failed the check).

So this is not a bug. But I think what we could do is to show Unknown (and same with Timeouts?) when --format is compact and the count is not zero. What do you think @mre?

@mre
Copy link
Member

mre commented Aug 28, 2024

Yup, good idea. We could change that. 👍

@mre
Copy link
Member

mre commented Aug 28, 2024

If you find the time, feel free to create a PR for that. Happy to get it merged.

@mre
Copy link
Member

mre commented Sep 9, 2024

@thomas-zahner fixed it in master. @guettli, in case you want to try, please check out lychee from the sources or wait until the next release.

@guettli
Copy link
Author

guettli commented Sep 9, 2024

@mre thank you very much. It is hard to reproduce, we get the useless http status code 999 only sometimes. I trust you. Thank you!

@mre mre closed this as completed Sep 27, 2024
@mre
Copy link
Member

mre commented Oct 7, 2024

This is now part of the latest release, 0.16.1.

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

No branches or pull requests

3 participants