actions / download-artifact

MIT License
1.38k stars 469 forks source link

[bug] Artifact download failed after 5 retries #339

Open marcosnr opened 2 months ago

marcosnr commented 2 months ago

What happened?

Using latest version, ids are the same in the same Workflow

    - name: Upload Terraform Plan
      uses: actions/upload-artifact@v4
      with:
        name: orgs_tfplan
        path: ./${{ env.ORG_STRUCTURE_PATH }}/orgs_tfplan
        retention-days: 8 
        if-no-files-found: error
        overwrite: true

logs for this are:

With the provided path, there will be 1 file uploaded
Artifact name is valid!
Root directory input is valid!
Beginning upload of artifact content to blob storage
Uploaded bytes 9522
Finished uploading artifact content to blob storage!
SHA256 hash of uploaded artifact zip is 55f6d093abc9fb923b81a2215443eaa21f4fb6f3458f42c66af8f73135339b60
Finalizing artifact upload
Artifact orgs_tfplan.zip successfully finalized. Artifact ID 1658704995
Artifact orgs_tfplan has been successfully uploaded! Final size is 9522 bytes. Artifact ID is 1658704995
Artifact download URL: https://github.com/lokalise/infra-secops/actions/runs/9757819524/artifacts/1658704995

The next step tries to download it:

    - name: Download Terraform Plan Test
      id: download-plan
      uses: actions/download-artifact@v4
      with:
        name: orgs_tfplan
        path: ./${{ env.ORG_STRUCTURE_PATH }}/orgs_tfplan

Error: Unable to download artifact(s): Unable to download and extract artifact: Artifact download failed after 5 retries Full log

Downloading single artifact
Preparing to download the following artifacts:
- orgs_tfplan (ID: 1658704995, Size: 9522)
Redirecting to blob download url: https://productionresultssa13.blob.core.windows.net/actions-results/9e701839-d365-4476-bc0e-2ab8b34ecb22/workflow-job-run-7e2501dc-18ab-5639-25c6-c45a87c8505c/artifacts/c123908d70f3d68b375b61d264a1acd0d4cb97713e9bbe063c8e900b1a12a769.zip
Starting download of artifact to: /home/runner/work/infra-secops/infra-secops/organization_structure/orgs_tfplan
(node:1794) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Error: Unable to download artifact(s): Unable to download and extract artifact: Artifact download failed after 5 retries.

What did you expect to happen?

The dowloaded artifact available at the given path

How can we reproduce it?

Create a simple workflow :


jobs:
  terraform_check:
    name: 'Terraform Check PR'
    runs-on: ubuntu-latest

    defaults:
      run:
        shell: bash
        working-directory: ./${{ env.ORG_STRUCTURE_PATH }}

with steps above?

Anything else we need to know?

No response

What version of the action are you using?

actions/download-artifact@v4

What are your runner environments?

linux

Are you on GitHub Enterprise Server? If so, what version?

No response

marknuzz commented 2 months ago

Also happening to me. Super annoying

vignesh-gupta-xom commented 2 months ago

It's a big issue for us as it's been used at enterprise level. Any workaround?

brandtkeller commented 2 months ago

Also experiencing the same problem - will investigate further.

si-robinson commented 2 months ago

Same here. For now, we've pinned it to the previous version: uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e

maltesoerensen1337 commented 2 months ago

Same here. For now, we've pinned it to the previous version: uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e

I'm getting the same error with that version.

But, in a different workflow that uses 4.1.8, it works:

Run actions/download-artifact@v4.1.8
Downloading single artifact
Preparing to download the following artifacts:
- xxx (ID: xxx, Size: 916)
Redirecting to blob download url: https://productionresultssa11.blob.core.windows.net/actions-results/xxx
Starting download of artifact to: /home/runner/work/xxx
(node:1928) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Artifact download completed successfully.
Total of 1 artifact(s) downloaded
Download artifact has finished successfully
maltesoerensen1337 commented 2 months ago

I was able to resolve my case and I have to admit it was avoidable ^^ The deprecation warning lead me on a wrong path.

When downloading the artifact, I specified the full filename instead of just the target directory. Changing that fixed the issue.

not working:

      - uses: actions/download-artifact@v4
        with:
          path: bpmn/my.bpmn
          name: bpmn-model

fixed:

      - uses: actions/download-artifact@v4
        with:
          path: bpmn
          name: bpmn-model

Hope this will help some of you others.

brandtkeller commented 2 months ago

Came back to say the same thing - Using the latest version and the problem was using the full filename path instead of the directory (as noted by @maltesoerensen1337 above).

Confusion in path use across upload/download but ultimately better annotation of path being target directory and NOT filename could resolve this.

rcdailey commented 2 months ago

My path is only a single directory and still times out... so path can't be the issue...

karl-cardenas-coding commented 2 months ago

This probably related to https://github.com/actions/download-artifact/issues/328#issuecomment-2209800401 My team and I have pinned to previous versions as the new patch versions are breaking behavior.

rcdailey commented 2 months ago

This is blocking my ability to release my software. Very frustrating. I don't know what the issue is. For my workflow, I'm using v4.0.0 for download-artifact and v4.2.0 for upload-artifact. I can't go any lower than these versions. The timeout issue still happens:

Error: Unable to download artifact(s): Unable to download and extract artifact: Not a valid zip file

I don't know why it says it isn't a valid zip file...

marknuzz commented 2 months ago

I think there are at least two separate issues here. One is with the path as some have said, and the other is an unknown intermittent issue. I am getting the intermittent failure, but it hasn't happened in the last few days. For those who are getting the issue unrelated to the path, could you mention whether it is a consistent or intermittent failure, and the date/time the failure occurred (if it only fails occasionally). Maybe it can be traced to an issue with the underlying infrastructure. Just spitballing here, perhaps it is an eventually-consistent system which isn't guaranteed to have the data available within a certain number of minutes (but usually does).

rcdailey commented 2 months ago

It was pretty consistent yesterday, until I reverted back to the latest v3 release for both the upload and download artifact actions. Then it finally worked again.

Here's an example run for my project:

https://github.com/recyclarr/recyclarr/actions/runs/9894793004/job/27333460964

vignesh-gupta-xom commented 2 months ago

I agree with @rcdailey! I was on my way to inform the same thing

lou-lan commented 1 month ago

Same issue here

##[debug]Failed to download artifact after 1 retries due to Not a valid zip file. Retrying in 5 seconds...
Artifact download completed successfully.
Artifact download completed successfully.
Artifact download completed successfully.
Artifact download completed successfully.
##[debug]Failed to download artifact after 1 retries due to Not a valid zip file. Retrying in 5 seconds...
Artifact download completed successfully.
Artifact download completed successfully.
##[debug]Failed to download artifact after 1 retries due to Not a valid zip file. Retrying in 5 seconds...
Artifact download completed successfully.
Artifact download completed successfully.
Artifact download completed successfully.
##[debug]Failed to download artifact after 2 retries due to Not a valid zip file. Retrying in 5 seconds...
##[debug]Failed to download artifact after 2 retries due to Not a valid zip file. Retrying in 5 seconds...
##[debug]Failed to download artifact after 2 retries due to Not a valid zip file. Retrying in 5 seconds...
##[debug]Failed to download artifact after 3 retries due to Not a valid zip file. Retrying in 5 seconds...
##[debug]Failed to download artifact after 3 retries due to Not a valid zip file. Retrying in 5 seconds...
##[debug]Failed to download artifact after 3 retries due to Not a valid zip file. Retrying in 5 seconds...
##[debug]Failed to download artifact after 4 retries due to Not a valid zip file. Retrying in 5 seconds...
##[debug]Failed to download artifact after 4 retries due to Not a valid zip file. Retrying in 5 seconds...
##[debug]Failed to download artifact after 4 retries due to Not a valid zip file. Retrying in 5 seconds...
##[debug]Failed to download artifact after 5 retries due to Not a valid zip file. Retrying in 5 seconds...
##[debug]Failed to download artifact after 5 retries due to Not a valid zip file. Retrying in 5 seconds...
##[debug]Failed to download artifact after 5 retries due to Not a valid zip file. Retrying in 5 seconds...
Error: Unable to download artifact(s): Unable to download and extract artifact: Artifact download failed after 5 retries.
/home/runner/work/_actions/actions/download-artifact/v4.1.8/dist/index.js:2478
            throw new Error(`Unable to download and extract artifact: ${error.message}`);
                  ^

Error: Unable to download and extract artifact: Artifact download failed after 5 retries.
    at /home/runner/work/_actions/actions/download-artifact/v4.1.8/dist/index.js:2478:19
    at Generator.throw (<anonymous>)
    at rejected (/home/runner/work/_actions/actions/download-artifact/v4.1.8/dist/index.js:2320:65)

Node.js v20.13.1
mashail commented 1 month ago

This could happen if the same file exists in the machine in the same path as the aciotion can not overwrite it. I had the same issue and it was due to the files exists with same name and path

bryancross commented 3 weeks ago

this happens to me every time I include a path parameter. If I remove the path parameter it works fine.

davetapley commented 3 weeks ago

Repro'd on both v3 and v4 with name parameter, 'restart failed jobs' didn't help (same error). Removed name: and it worked first time. ~Not sure if correlated.~

_Edit: added name: back and it occurred again, so seems reproducible:

With name: ubuntu-20.04

Run actions/download-artifact@v4
  with:
    name: ubuntu-20.04
    merge-multiple: false
    repository: XXXX
    run-id: XXX
Downloading single artifact
Preparing to download the following artifacts:
- ubuntu-20.04 (ID: XXXX, Size: 263647586)
Redirecting to blob download url: https://productionresultssa11.blob.core.windows.net/actions-results/XXXX
Starting download of artifact to: /home/runner/work/XXXX
(node:2083) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

Without name: (note successfully finds and downloads ubuntu-20.04)

Run actions/download-artifact@v4
Found 3 artifact(s)
No input name or pattern filtered specified, downloading all artifacts
An extra directory with the artifact name will be created for each download
Preparing to download the following artifacts:
- windows-latest (ID: XXX, Size: 148871706)
- ng-installer-win (ID: XXX, Size: 101844405)
- ubuntu-20.04 (ID: XXX, Size: 263647521)
Redirecting to blob download url: https://productionresultssa11.blob.core.windows.net/actions-resultsXXXX
Starting download of artifact to: /home/runner/work/XXX
Redirecting to blob download url: https://productionresultssa11.blob.core.windows.net/actions-results/XXX
Starting download of artifact to: /home/runner/work/XXX
Redirecting to blob download url: https://productionresultssa11.blob.core.windows.net/actions-results/XXX
Starting download of artifact to: /home/runner/work/XXX
(node:2114) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Artifact download completed successfully.
Artifact download completed successfully.
Artifact download completed successfully.
Total of 3 artifact(s) downloaded
Download artifact has finished successfully
Thenlie commented 2 weeks ago

I was seeing this same behavior on this workflow in free-programming-books. Oddly, this was only impacting the README.md file, other files artifacts would properly download. An example run can be seen here.

Downgrading actions/download-artifact to v3 resolved the problem for us. This was done after trying to remove the name property and use v4.1.8 without success.