commercialhaskell / commercialhaskell/stack
On `StorageMigrationFailure`, Stack should try its workaround (delete database, try again)
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
### General summary/comments (optional)
I am running into this issue on CI, so it's a bit difficult to provide fully detailed reproduction steps. Additionally, I'm pretty sure it's happening due to an 'out-of-space' error on a previous run and the cache being borked. Deleting the CI cache fixes the issue, so that's an OK work-around.
### Steps to reproduce
1. Run a CI build
2. Have that CI build run out of disk space, possibly while updating Pantry
3. Cache the `~/.stack` folder
4. Run another CI build
### Expected
The CI build to complete.
Could `stack` catch the exception, recognize that the Pantry database is corrupted, and recreate it?
### Actual
```
+ stack setup
Encountered error while migrating Pantry database:
SQLite3 returned ErrorNotFound while attempting to perform prepare "SELECT sql FROM sqlite_master WHERE type='table' AND name=?": database disk image is malformed
Please report this on https://github.com/commercialhaskell/stack/issues
As a workaround you may delete Pantry database in /builds/lumi-tech/lumi/.stack-root/pantry/pantry.sqlite3 triggering its recreation.
```
### Stack version
### Method of installation
```
curl -sSL https://get.haskellstack.org/ | sh
```
Contributor guide
Assessment
This issue has not been assessed yet.