hashicorp/packer · error

something went wrong retrieving the build %s from bucket %s

Error message

something went wrong retrieving the build %s from bucket %s

What it means

UpdateBuild calls PackerServiceUpdateBuild to update a build record in an HCP Packer bucket; when the call succeeds but the response object is nil, it cannot extract the build ID and returns this error. Called by UpdateBuildStatus and markBuildComplete during build status reporting to the registry. A nil response after a nil error is an unexpected API contract violation.

Source

Thrown at internal/hcp/api/service_build.go:93

	params.Body = &hcpPackerModels.HashicorpCloudPacker20230101UpdateBuildBody{
		Artifacts:                artifacts,
		Labels:                   buildLabels,
		PackerRunUUID:            runUUID,
		ParentChannelID:          parentChannelID,
		ParentVersionID:          parentVersionID,
		Platform:                 platform,
		SourceExternalIdentifier: sourceExternalIdentifier,
		Status:                   &buildStatus,
		Metadata:                 metadata,
	}

	resp, err := c.Packer.PackerServiceUpdateBuild(params, nil)
	if err != nil {
		return "", err
	}

	if resp == nil {
		return "", fmt.Errorf(
			"something went wrong retrieving the build %s from bucket %s", buildID, bucketName,
		)
	}

	return resp.Payload.Build.ID, nil
}

func (c *Client) UploadSbom(
	ctx context.Context,
	bucketName, fingerprint string,
	buildID string,
	sbom packer.SBOM,
) error {

	params := hcpPackerAPI.NewPackerServiceUploadSbomParamsWithContext(ctx)
	params.BuildID = buildID
	params.LocationOrganizationID = c.OrganizationID
	params.LocationProjectID = c.ProjectID

View on GitHub (pinned to eb36e3c3e4)

Solutions

  1. Retry the build status update; the failure is often transient.
  2. Verify the bucket and version still exist in the HCP Packer registry.
  3. Upgrade the packer-plugin-sdk / HCP API client to the latest version.
  4. Check HCP status page for ongoing incidents if it reproduces.

Example fix

// before
// no retry around UpdateBuildStatus
// after
if err := updateBuildStatusWithRetry(ctx, client, buildID, bucketName, status, 3); err != nil {
    return fmt.Errorf("updating build status: %w", err)
}
Defensive patterns

Strategy: retry

Validate before calling

// ensure the bucket/version still exists before updating builds
if err := client.GetVersion(ctx, bucketName, fingerprint); err != nil {
    return fmt.Errorf("bucket %s version gone; aborting build update", bucketName)
}

Try / catch

buildID, err := client.UpdateBuild(ctx, bucketName, iterationID, &build)
if err != nil {
    if strings.Contains(err.Error(), "something went wrong retrieving the build") {
        return retryWithBackoff(ctx, 3, func() error { _, err := client.UpdateBuild(...); return err })
    }
    return err
}

Prevention

When it happens

Trigger: PackerServiceUpdateBuild returns (nil, nil) — no error but no response payload — while updating the build for buildID in bucketName.

Common situations: Transient/edge HCP API behavior returning empty responses; build or bucket already removed from the registry mid-update; SDK version drift producing untyped nil responses; concurrent builds deleting the parent version.

Related errors


AI-assisted analysis of hashicorp/packer@eb36e3c3e4 (2026-09-05). Data as JSON: /api/errors/839f0304b83d6cdc. Report an issue: GitHub.