question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Step should not succeed when tar fails with error

See original GitHub issue

Using a simple step to restore the build x cache we encountered an error (below). I believe the issue is that the GitHub cache became corrupt. However actions/cache did not catch the error.

      - name: Cache layers
        uses: actions/cache@v2
        with:
          path: /tmp/.buildx-cache
          key: ${{ runner.os }}-buildx-${{ github.sha }}
          restore-keys: |
            ${{ runner.os }}-buildx-

So only a warning was printed instead of failing the step:

....
/*stdin*\ : Decoding error (36) : Restored data doesn't match checksum 
/usr/bin/tar: Child returned status 1
/usr/bin/tar: Error is not recoverable: exiting now
Warning: Tar failed with error: The process '/usr/bin/tar' failed with exit code 2

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
bishal-pdMSFTcommented, Jun 30, 2022

Btw, there are REST APIs available now to be able to delete a corrupted cache. This can help come out of a situation where a cache is corrupted the only alternative is to update the cache key forcibly.

1reaction
bishal-pdMSFTcommented, Jun 30, 2022

Or the action could report whether the cache was successfully restored or not via an output, that way users could decide for themselves whether to proceed or not.

That is already possible with cache-hit output. It is set if a cache has been restored with exact matching key. If it is not set, then it is a good idea to run the install/build steps.

The action should restore the cache completely or not at all.

Agree. Any failure in unarchiving should be handled more cleanly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

tar: Exiting with failure status due to previous errors - Super User
I do not see any error messages whilst the script is working, and like I said, the produced file can be uncompressed with...
Read more >
Github Actions "Set up job" fails with tar error · Issue #815
Since earlier today, a Github Actions workflow which has been working reliably for many months has started failing with a tar error.
Read more >
tar exits with "write error" even though there is no error at all
(5) tar correctly handles the write error upon exit. What was not really obvious is step (2). I checked the behavior of ksh/bash/zsh...
Read more >
Error code 141 with tar - Stack Overflow
My guess here is that gzip is uncompressing the file successfully, but the uncompressed stream is not a valid tar archive. My advice...
Read more >
"tar: .: Cannot utime: Operation not permitted" while ... - ERROR
To resolve this issue, ​move the tar file into a directory that you are the owner of. This will allow you to completely...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found