lychee icon indicating copy to clipboard operation
lychee copied to clipboard

--cache-exclude-status can't exclude failures that have no status code

Open katexochen opened this issue 4 months ago • 3 comments

Given a file with the following unresolveable domain name:

https://llkalsaslasdbasdbasdb.google.com

And having lychee configured to ignore error status when caching via

cache_exclude_status = [
    "..100",
    "104..200",
    "300..600",
]

I get the following error

   [ERROR] https://llkalsaslasdbasdbasdb.google.com/ | Network error: error sending request for url (https://llkalsaslasdbasdbasdb.google.com/) Maybe a certificate error?

And the following cache entry

❯ cat .lycheecache | grep llkalsaslasdbasdbasdb
https://llkalsaslasdbasdbasdb.google.com/,,1754564166

As there is no status code returned, there is currently no way to exclude these error from being cached.

lychee should provide a way to ignore these failures, too.

(I tried to use the empty string in cache_exclude_status, but that fails when the config is parsed)

katexochen avatar Aug 07 '25 11:08 katexochen

Alternatively, errors without a status code should never be cacheable. I don't know if there's any unexpected side effect from that, but the cache entry certainly looks weird.

mre avatar Aug 07 '25 12:08 mre

Alternatively, errors without a status code should never be cacheable.

Agree, that's a good solution.

katexochen avatar Aug 18 '25 14:08 katexochen

I would like to hear some more opinions on this first before making any bad decisions. I have a track record for those. 😅

mre avatar Aug 19 '25 13:08 mre