{"record":{"id":"c5e6d55220a61d90","repo":"hashicorp/packer","slug":"error-listing-builds-for-this-existing-version-s","errorCode":null,"errorMessage":"error listing builds for this existing version: %s","messagePattern":"error listing builds for this existing version: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/hcp/registry/types.bucket.go","lineNumber":526,"sourceCode":"\t\t\t\"The version associated to the fingerprint %v is complete. If you wish to add a new build to \"+\n\t\t\t\t\"this bucket a new version must be created by changing the fingerprint.\",\n\t\t\tbucket.Version.Fingerprint,\n\t\t)\n\t}\n\n\treturn nil\n}\n\n// populateVersion populates the version with the details needed for tracking builds for a Packer run.\n// If a version exists for the said fingerprint, calling initialize on version that doesn't yet exist will call\n// createVersion to create the entry on the HCP packer registry for the given bucket.\n// All build details will be created (if they don't exist) and added to b.Version.builds for tracking during runtime.\nfunc (bucket *Bucket) populateVersion(ctx context.Context) error {\n\t// list all this version's builds so we can figure out which ones\n\t// we want to run against. TODO: pagination?\n\texistingBuilds, err := bucket.client.ListBuilds(ctx, bucket.Name, bucket.Version.Fingerprint)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error listing builds for this existing version: %s\", err)\n\t}\n\n\tvar toCreate []string\n\tfor _, expected := range bucket.Version.expectedBuilds {\n\t\tvar found bool\n\t\tfor _, existing := range existingBuilds {\n\n\t\t\tif existing.ComponentType == expected {\n\t\t\t\tfound = true\n\t\t\t\tbuild, err := NewBuildFromCloudPackerBuild(existing)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"Unable to load existing build for %q: %v\", existing.ComponentType, err)\n\t\t\t\t}\n\n\t\t\t\t// When running against an existing build the Packer RunUUID is most likely different.\n\t\t\t\t// We capture that difference here to know that the artifacts were created in a different Packer run.\n\t\t\t\tbuild.RunUUID = bucket.Version.RunUUID\n","sourceCodeStart":508,"sourceCodeEnd":544,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/internal/hcp/registry/types.bucket.go#L508-L544","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Check connectivity and credentials before running\n// curl -sS -o /dev/null -w '%{http_code}' https://api.cloud.hashicorp.com/ || echo unreachable\n// test -n \"$HCP_CLIENT_ID\" && test -n \"$HCP_CLIENT_SECRET\" || echo 'missing HCP credentials'","typeGuard":null,"tryCatchPattern":"// Go\nif err := bucket.Initialize(ctx); err != nil {\n\tvar netErr net.Error\n\tif strings.Contains(err.Error(), \"error listing builds\") {\n\t\t// transient network/API failure: retry with backoff\n\t\treturn retryWithBackoff(ctx, 3, func() error { return bucket.Initialize(ctx) })\n\t}\n\t_ = netErr\n\treturn err\n}","preventionTips":["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"],"tags":["hcp-packer","api-call","network","list-builds"],"backgroundTag":"hcp-api-request-failed","analyzedSha":"eb36e3c3e48a036f3e8cc94087636ee72e1303c9","analyzedAt":"2026-09-05T13:20:43.127Z","contentChangedAt":"2026-09-05T13:20:43.127Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}