hashicorp/packer · error
error listing builds for this existing version: %s
Error message
error listing builds for this existing version: %s
What it means
populateVersion lists the builds already registered on HCP Packer for the bucket's current version so Packer can reconcile them with the builds it is about to run. If bucket.client.ListBuilds fails (network error, auth failure, API error), the error is wrapped in this message and Bucket initialization aborts.
Source
Thrown at internal/hcp/registry/types.bucket.go:526
"The version associated to the fingerprint %v is complete. If you wish to add a new build to "+
"this bucket a new version must be created by changing the fingerprint.",
bucket.Version.Fingerprint,
)
}
return nil
}
// populateVersion populates the version with the details needed for tracking builds for a Packer run.
// If a version exists for the said fingerprint, calling initialize on version that doesn't yet exist will call
// createVersion to create the entry on the HCP packer registry for the given bucket.
// All build details will be created (if they don't exist) and added to b.Version.builds for tracking during runtime.
func (bucket *Bucket) populateVersion(ctx context.Context) error {
// list all this version's builds so we can figure out which ones
// we want to run against. TODO: pagination?
existingBuilds, err := bucket.client.ListBuilds(ctx, bucket.Name, bucket.Version.Fingerprint)
if err != nil {
return fmt.Errorf("error listing builds for this existing version: %s", err)
}
var toCreate []string
for _, expected := range bucket.Version.expectedBuilds {
var found bool
for _, existing := range existingBuilds {
if existing.ComponentType == expected {
found = true
build, err := NewBuildFromCloudPackerBuild(existing)
if err != nil {
return fmt.Errorf("Unable to load existing build for %q: %v", existing.ComponentType, err)
}
// When running against an existing build the Packer RunUUID is most likely different.
// We capture that difference here to know that the artifacts were created in a different Packer run.
build.RunUUID = bucket.Version.RunUUID
View on GitHub (pinned to eb36e3c3e4)
Solutions
- Check network connectivity and access to api.cloud.hashicorp.com from the build machine
- Verify HCP credentials (HCP_CLIENT_ID/HCP_CLIENT_SECRET) are valid and not expired
- Confirm the bucket name and fingerprint are correct in the HCP Packer portal
- Retry the build; if the service is degraded wait for recovery
- Inspect the wrapped inner error (%s) for the specific HTTP/gRPC code returned
Defensive patterns
Strategy: retry
Validate before calling
// Check connectivity and credentials before running
// curl -sS -o /dev/null -w '%{http_code}' https://api.cloud.hashicorp.com/ || echo unreachable
// test -n "$HCP_CLIENT_ID" && test -n "$HCP_CLIENT_SECRET" || echo 'missing HCP credentials' Try / catch
// Go
if err := bucket.Initialize(ctx); err != nil {
var netErr net.Error
if strings.Contains(err.Error(), "error listing builds") {
// transient network/API failure: retry with backoff
return retryWithBackoff(ctx, 3, func() error { return bucket.Initialize(ctx) })
}
_ = netErr
return err
} Prevention
- Validate HCP_CLIENT_ID/HCP_CLIENT_SECRET in CI before running builds
- Whitelist api.cloud.hashicorp.com in firewalls/proxies
- Add retry-with-backoff around packer build in CI for transient 5xx
- Confirm bucket names against the HCP portal to avoid 404s
When it happens
Trigger: bucket.Initialize()/PopulateVersion() calls bucket.client.ListBuilds(ctx, bucket.Name, fingerprint) and the HCP Packer API call returns an error — e.g. network outage, expired credentials, 4xx/5xx from the service, or pagination issues.
Common situations: HCP Packer service outage or degradation; invalid/expired HCP credentials (PCP_* env vars, token refresh failure); corporate proxy/firewall blocking api.cloud.hashicorp.com; bucket name typos causing 404s.
Related errors
- error retrieving iteration from HCP Packer registry: %s
- failed to update HCP Packer Build status for %q: %s
- failed to add artifact for %q: %s
- Failed to upload sboms %s
- error retrieving version from HCP Packer Registry: %s
AI-assisted analysis of hashicorp/packer@eb36e3c3e4 (2026-09-05).
Data as JSON: /api/errors/c5e6d55220a61d90.
Report an issue: GitHub.