hashicorp/packer · error

there is no HCP Packer Version associated with the channel %

Error message

there is no HCP Packer Version associated with the channel %s

What it means

The channel exists in the HCP Packer Registry but has no version assigned to it, so the datasource cannot return a version. Channels must point at a published, non-revoked version to be usable. The datasource fails with this message instead of returning an empty object.

Source

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

	cli, err := hcpapi.NewClient()
	if err != nil {
		return cty.NullVal(cty.EmptyObject), err
	}
	log.Printf(
		"[INFO] Reading HCP Packer Version info from HCP Packer Registry (%s) "+
			"[project_id=%s, organization_id=%s, channel=%s]",
		d.config.BucketName, cli.ProjectID, cli.OrganizationID, d.config.ChannelName,
	)

	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),

View on GitHub (pinned to eb36e3c3e4)

Solutions

  1. Assign a version to the channel in the HCP Packer UI or via `hcp packer channels` tooling
  2. Run a build that releases a version to the bucket and point the channel at it
  3. If the intended version was revoked, un-revoke it or point the channel at another version
  4. Switch the template to a different channel that already has a version

Example fix

// before
channel_name = "staging" // no version assigned
// after
channel_name = "production" // has a released version
Defensive patterns

Strategy: validation

Validate before calling

// pre-check via HCP API that channel has a version
// GET /packer/2023-01-01/registry/{org}/{proj}/bucket/{bucket}/channel/{channel}
// ensure response.channel.version != nil

Type guard

if channel.Version == nil { return fmt.Errorf("no version on channel %s", name) }

Prevention

When it happens

Trigger: GetChannel succeeds but the returned channel object's Version field is nil — i.e., the channel was created but never assigned a version, or its assigned version was removed.

Common situations: Newly created channels in a fresh registry before the first build published a version; a channel whose version was revoked/deleted leaving the channel dangling; typos picking an empty channel.

Related errors


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