How do you troubleshoot 'No package found with specified pattern' errors in Azure DevOps release pipelines?
Quick Answer
This error occurs when a deployment task cannot find the artifact file matching the specified glob pattern. Common causes are incorrect artifact paths after pipeline restructuring, mismatched artifact names between build and release stages, path case sensitivity on Linux agents, and the artifact not being published in the build stage. Fix by verifying the actual artifact structure with a directory listing step.
Detailed Answer
Think of this error like a delivery driver arriving at a warehouse with instructions to pick up a package labeled 'box-A from shelf-3, aisle-7' but finding that the warehouse has been reorganized — the package exists but is now on shelf-5, aisle-2. The instructions (glob pattern) no longer match reality (actual artifact location). The fix is not changing the package but updating the instructions to reflect where the package actually lives. In Azure DevOps, the 'instructions' are the file path pattern in your deployment task, and the 'warehouse' is the artifact staging directory.
The most common cause is a mismatch between where the build stage publishes artifacts and where the release stage looks for them. When a pipeline publishes an artifact named 'drop' containing 'payments-api.zip', the artifact is available at $(Pipeline.Workspace)/drop/payments-api.zip in subsequent stages. If the deployment task specifies $(System.DefaultWorkingDirectory)/drop/payments-api.zip (the Classic release pipeline path) or $(Build.ArtifactStagingDirectory)/payments-api.zip (the build-stage path), the pattern fails because those directories do not contain the artifact in the release context. The actual path depends on whether you use Classic releases or YAML multi-stage pipelines, as each has different workspace structures.
Path case sensitivity catches many teams migrating from Windows to Linux agents. Windows file systems are case-insensitive, so 'PaymentsAPI.zip' matches 'paymentsapi.zip'. Linux file systems are case-sensitive, so the pattern must exactly match the published file name including capitalization. A pipeline that worked for months on Windows agents suddenly fails when moved to Linux because the glob pattern 'payments-api.zip' does not match the actually published 'Payments-API.zip'. Always use consistent casing throughout your pipeline.
The artifact download step configuration is another frequent culprit. In YAML multi-stage pipelines, artifacts from a previous stage must be explicitly downloaded using the download keyword or DownloadPipelineArtifact task. If you forget the download step, the artifact directory is empty and no pattern matches. In Classic release pipelines, artifacts are downloaded automatically if the artifact source is configured correctly, but the download location varies based on the artifact type (Build, GitHub, Azure Artifacts) and the agent's workspace layout.
Wildcard patterns add another layer of complexity. A pattern like '**/*.zip' searches recursively but depends on the working directory context. If the task's working directory is set incorrectly, the recursive search starts from the wrong root and misses the file. Similarly, patterns using specific version numbers like 'payments-api-1.2.*.zip' fail when the actual artifact is named with a different version format. Using a more general pattern and letting the task select the latest file is more robust than encoding version numbers in the pattern.
The production gotcha is intermittent failures caused by artifact download timing or size limits. Large artifacts (>1GB) sometimes fail to download within the task timeout, leaving a partially downloaded file that does not match the expected pattern. Pipeline artifact storage has retention policies — if the build that produced the artifact has been cleaned up by retention rules, the artifact no longer exists and the download silently produces an empty directory. Teams should monitor artifact sizes, set appropriate timeouts, and ensure retention policies keep artifacts alive until all releases consuming them complete.