hashicorp/packer · error

failed to initialize version for fingerprint %s: %s

Error message

failed to initialize version for fingerprint %s: %s

What it means

HCP registry error from Bucket.initializeVersion: resolving the build's version by fingerprint failed — the lookup for an existing version and the attempt to create a new one both errored. The wrapped cause is the HCP API error.

Source

Thrown at internal/hcp/registry/types.bucket.go:481

	log.Println(
		"[TRACE] a valid version for build was created with the Id", createVersionResp.Payload.Version.ID,
	)
	return createVersionResp.Payload.Version, nil
}

func (bucket *Bucket) initializeVersion(
	ctx context.Context, templateType hcpPackerModels.HashicorpCloudPacker20230101TemplateType,
) error {
	// load existing version using fingerprint.
	version, err := bucket.client.GetVersion(ctx, bucket.Name, bucket.Version.Fingerprint)
	if hcpPackerAPI.CheckErrorCode(err, codes.Aborted) {
		// probably means Version doesn't exist need a way to check the error
		version, err = bucket.createVersion(templateType)
	}

	if err != nil {
		return fmt.Errorf("failed to initialize version for fingerprint %s: %s", bucket.Version.Fingerprint, err)
	}

	if version == nil {
		return fmt.Errorf("failed to initialize version details for Bucket %s with error: %w", bucket.Name, err)
	}

	if version.TemplateType != nil &&
		*version.TemplateType != hcpPackerModels.HashicorpCloudPacker20230101TemplateTypeTEMPLATETYPEUNSET &&
		*version.TemplateType != templateType {
		return fmt.Errorf(
			"This version was initially created with a %[2]s template. "+
				"Changing from %[2]s to %[1]s is not supported",
			templateType, *version.TemplateType,
		)
	}

	log.Println(
		"[TRACE] a valid version was retrieved with the id", version.ID,

View on GitHub (pinned to eb36e3c3e4)

Solutions

  1. Check HCP service status and credentials, then retry the build
  2. Verify the bucket fingerprint is not corrupted (custom HCP_PACKER_BUCKET_FINGERPRINT values)
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/hcp/registry/types.bucket.go:481 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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