hashicorp/packer · error

the HCP Packer Version associated with the channel %s is rev

Error message

the HCP Packer Version associated with the channel %s is revoked and can not be used on Packer builds

What it means

The version the channel points to has status VERSION_REVOKED, meaning it was deliberately marked unusable in HCP Packer (e.g., after a security incident or bad build). Revoked versions are excluded from builds, so the datasource refuses to return it.

Source

Thrown at datasource/hcp-packer-version/data.go:130

	channel, err := cli.GetChannel(ctx, d.config.BucketName, d.config.ChannelName)
	if err != nil {
		return cty.NullVal(cty.EmptyObject), fmt.Errorf(
			"error retrieving HCP Packer Version from HCP Packer Registry: %s",
			err.Error(),
		)
	}
	if channel.Version == nil {
		return cty.NullVal(cty.EmptyObject), fmt.Errorf(
			"there is no HCP Packer Version associated with the channel %s",
			d.config.ChannelName,
		)
	}

	version := channel.Version

	if *version.Status == hcpPackerModels.HashicorpCloudPacker20230101VersionStatusVERSIONREVOKED {
		return cty.NullVal(cty.EmptyObject), fmt.Errorf(
			"the HCP Packer Version associated with the channel %s is revoked and can not be used on Packer builds",
			d.config.ChannelName,
		)
	}

	output := DatasourceOutput{
		AuthorID:    version.AuthorID,
		BucketName:  version.BucketName,
		Status:      string(*version.Status),
		CreatedAt:   version.CreatedAt.String(),
		Fingerprint: version.Fingerprint,
		ID:          version.ID,
		Name:        version.Name,
		UpdatedAt:   version.UpdatedAt.String(),
		ChannelID:   channel.ID,
	}

	return hcl2helper.HCL2ValueFromConfig(output, d.OutputSpec()), nil

View on GitHub (pinned to eb36e3c3e4)

Solutions

  1. Re-point the channel to a healthy version in the HCP Packer UI
  2. If the revocation was accidental, restore/un-revoke the version in HCP
  3. Pin the datasource to a specific version via a channel that tracks an approved version
  4. Update the template to use a different bucket/channel

Example fix

// before
channel_name = "prod" // points to revoked version
// after
channel_name = "prod-approved" // points to healthy version
Defensive patterns

Strategy: validation

Validate before calling

// check version status before use
if channel.Version != nil && channel.Version.Status == "VERSION_REVOKED" { panic("channel points to revoked version") }

Type guard

func usable(v *hcpPackerModels.Version) bool { return v != nil && v.Status != hcpPackerModels.HashicorpCloudPacker20230101VersionStatusVERSIONREVOKED }

Prevention

When it happens

Trigger: Channel lookup succeeds and a version is attached, but version.Status is HashicorpCloudPacker20230101VersionStatusVERSIONREVOKED.

Common situations: Ops revoked a compromised image version; channels were not re-pointed; CI pipelines still referencing the revoked channel break during `packer init`/build.

Related errors


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