hashicorp/packer · error
build failed, not uploading artifacts
Error message
build failed, not uploading artifacts
What it means
completeBuild is called when a build finishes. If the build itself errored (buildErr != nil), Packer marks the build FAILED (or CANCELLED if the context was cancelled) in HCP Packer and returns this error to signal that no artifacts will be uploaded to the registry. It is the user-facing consequence of the build failing, not a registry failure itself.
Source
Thrown at internal/hcp/registry/types.bucket.go:744
if !ok {
log.Print("[ERROR] done build does not have an entry in the heartbeat table, state will be inconsistent.")
} else {
log.Printf("[TRACE] signal stopping heartbeats")
// Stop heartbeating
doneCh <- struct{}{}
log.Printf("[TRACE] stopped heartbeats")
}
if buildErr != nil {
status := hcpPackerModels.HashicorpCloudPacker20230101BuildStatusBUILDFAILED
if ctx.Err() != nil {
status = hcpPackerModels.HashicorpCloudPacker20230101BuildStatusBUILDCANCELLED
}
err := bucket.UpdateBuildStatus(context.Background(), buildName, status)
if err != nil {
log.Printf("[ERROR] failed to update build %q status to FAILED: %s", buildName, err)
}
return packerSDKArtifacts, fmt.Errorf("build failed, not uploading artifacts")
}
artifacts, err := bucket.doCompleteBuild(ctx, buildName, packerSDKArtifacts, ui, buildErr)
if err != nil {
err := bucket.UpdateBuildStatus(ctx, buildName, hcpPackerModels.HashicorpCloudPacker20230101BuildStatusBUILDFAILED)
if err != nil {
log.Printf("[ERROR] failed to update build %q status to FAILED: %s", buildName, err)
}
}
return artifacts, err
}
func (bucket *Bucket) doCompleteBuild(
ctx context.Context,
buildName string,
packerSDKArtifacts []packerSDK.Artifact,
ui packerSDK.Ui,View on GitHub (pinned to eb36e3c3e4)
Solutions
- Read the build log above this error for the actual builder/provisioner failure and fix that root cause
- If cancelled, re-run the build with adequate timeouts
- Verify communicator connectivity (SSH/WinRM credentials, security groups) if provisioning failed
- Re-run packer build after fixing; artifacts will upload once the build succeeds
Defensive patterns
Strategy: try-catch
Try / catch
// Go
artifacts, err := bucket.CompleteBuild(ctx, buildName, arts, ui, buildErr)
if err != nil {
if strings.Contains(err.Error(), "build failed, not uploading artifacts") {
// root cause is in buildErr — surface it, don't retry the upload
return fmt.Errorf("build failed upstream: %w", buildErr)
}
return err
} Prevention
- Fix the underlying builder/provisioner error reported before this message
- Set generous CI timeouts to avoid context cancellation mid-build
- Validate provisioner scripts locally before registry-backed runs
- Check communicator connectivity (SSH keys, security groups) before long builds
When it happens
Trigger: Bucket.CompleteBuild -> completeBuild is invoked with a non-nil buildErr — i.e. the underlying builder/provisioner failed or the run context was cancelled — so completeBuild skips doCompleteBuild and returns "build failed, not uploading artifacts".
Common situations: Provisioner script failure; builder could not reach the source image or SSH; user pressed Ctrl-C (ctx cancelled -> CANCELLED status); CI timeout killing the run; any plugin error during the build.
Related errors
- No HCP Packer-compatible artifacts were found for the build
- error retrieving version from HCP Packer Registry: %s
- error retrieving channel from HCP Packer Registry: %s
- there is no version associated with the channel %s
- the version %s is revoked and can not be used on Packer buil
AI-assisted analysis of hashicorp/packer@eb36e3c3e4 (2026-09-05).
Data as JSON: /api/errors/00a178ef67263998.
Report an issue: GitHub.