Skip to content
Latchkey

Azure Pipelines "Artifact publish failed" / "Path does not exist"

The publish step could not upload your artifact. Usually the path/targetPath points at a directory that does not exist (the build never produced it), or an artifact of the same name was already published in the run.

What this error means

A PublishPipelineArtifact@1 (or PublishBuildArtifacts@1) step fails with Path does not exist, Publish artifact failed, or An artifact with the name X already exists. The build steps may have passed, so the problem is the path or naming, not the code.

Azure DevOps
##[error]Path does not exist: /home/vsts/work/1/s/dist
##[error]An error occurred while publishing artifact. An artifact with
the name 'drop' already exists.

Common causes

The publish path was never produced

The build did not create the directory you point at (wrong working directory, a build that silently produced nothing, or a path relative to the wrong root).

Duplicate artifact name in the same run

Publishing two artifacts with the same name - often from a matrix where every leg uses drop - collides. Pipeline artifact names must be unique per run.

How to fix it

Point at the real output and verify it exists

Use a predefined directory variable and confirm the path before publishing.

azure-pipelines.yml
steps:
  - script: ls -la $(Build.SourcesDirectory)/dist
  - task: PublishPipelineArtifact@1
    inputs:
      targetPath: '$(Build.SourcesDirectory)/dist'
      artifact: 'web-dist'

Make artifact names unique per matrix leg

Suffix the artifact name with a matrix variable so parallel legs don’t collide.

azure-pipelines.yml
artifact: 'drop-$(Agent.JobName)'

How to prevent it

  • Reference $(Build.ArtifactStagingDirectory) / $(Build.SourcesDirectory) rather than hard-coded paths.
  • List the directory before publishing to fail with a clear message.
  • Give each matrix leg a unique artifact name.

Frequently asked questions

What causes ""artifact publish failed""?
The build did not create the directory you point at (wrong working directory, a build that silently produced nothing, or a path relative to the wrong root).
How do I fix "artifact publish failed"?
Use a predefined directory variable and confirm the path before publishing.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card