Skip to content

failed to open cache db: timeout #592

@9999years

Description

@9999years

Describe the bug

It is possible to get the treefmt cache database into a bad state where all treefmt operations fail, including treefmt --clear-cache!

To Reproduce

We do not have a reproducer available, but we will update this ticket if we find one.

This issue manifests with errors instead of formatting:

$ treefmt
Error: failed to open cache: failed to open cache db: timeout
$ treefmt --clear-cache
Error: failed to open cache: failed to open cache db: timeout

Expected behavior

When treefmt is run, it should work instead of crashing.

If the cache database is corrupted, it should be deleted instead of crashing treefmt.

treefmt --clear-cache should never fail because the cache database is unavailable; the database should be deleted, not opened.

System information

macOS, treefmt v2.2.1

Additional context

The issue was resolved by manually deleting ~/Library/Caches/treefmt. This was challenging because the cache directory is not documented, and the source code implies it lives in $XDG_CACHE_HOME, which is not how treefmt behaves on macOS.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions