{"record":{"id":"40911cddac0b43aa","repo":"hashicorp/packer","slug":"there-is-no-hcp-packer-version-associated-with-the","errorCode":null,"errorMessage":"there is no HCP Packer Version associated with the channel %s","messagePattern":"there is no HCP Packer Version associated with the channel (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"datasource/hcp-packer-version/data.go","lineNumber":121,"sourceCode":"\tcli, err := hcpapi.NewClient()\n\tif err != nil {\n\t\treturn cty.NullVal(cty.EmptyObject), err\n\t}\n\tlog.Printf(\n\t\t\"[INFO] Reading HCP Packer Version info from HCP Packer Registry (%s) \"+\n\t\t\t\"[project_id=%s, organization_id=%s, channel=%s]\",\n\t\td.config.BucketName, cli.ProjectID, cli.OrganizationID, d.config.ChannelName,\n\t)\n\n\tchannel, err := cli.GetChannel(ctx, d.config.BucketName, d.config.ChannelName)\n\tif err != nil {\n\t\treturn cty.NullVal(cty.EmptyObject), fmt.Errorf(\n\t\t\t\"error retrieving HCP Packer Version from HCP Packer Registry: %s\",\n\t\t\terr.Error(),\n\t\t)\n\t}\n\tif channel.Version == nil {\n\t\treturn cty.NullVal(cty.EmptyObject), fmt.Errorf(\n\t\t\t\"there is no HCP Packer Version associated with the channel %s\",\n\t\t\td.config.ChannelName,\n\t\t)\n\t}\n\n\tversion := channel.Version\n\n\tif *version.Status == hcpPackerModels.HashicorpCloudPacker20230101VersionStatusVERSIONREVOKED {\n\t\treturn cty.NullVal(cty.EmptyObject), fmt.Errorf(\n\t\t\t\"the HCP Packer Version associated with the channel %s is revoked and can not be used on Packer builds\",\n\t\t\td.config.ChannelName,\n\t\t)\n\t}\n\n\toutput := DatasourceOutput{\n\t\tAuthorID:    version.AuthorID,\n\t\tBucketName:  version.BucketName,\n\t\tStatus:      string(*version.Status),","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/datasource/hcp-packer-version/data.go#L103-L139","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Assign a version to the channel in the HCP Packer UI or via `hcp packer channels` tooling","Run a build that releases a version to the bucket and point the channel at it","If the intended version was revoked, un-revoke it or point the channel at another version","Switch the template to a different channel that already has a version"],"exampleFix":"// before\nchannel_name = \"staging\" // no version assigned\n// after\nchannel_name = \"production\" // has a released version","handlingStrategy":"validation","validationCode":"// pre-check via HCP API that channel has a version\n// GET /packer/2023-01-01/registry/{org}/{proj}/bucket/{bucket}/channel/{channel}\n// ensure response.channel.version != nil","typeGuard":"if channel.Version == nil { return fmt.Errorf(\"no version on channel %s\", name) }","tryCatchPattern":null,"preventionTips":["Never create channels without assigning a version","Automate channel updates on each released version","Use `hcp packer channels` CLI to audit channel state in CI"],"tags":["hcp","datasource","channel"],"backgroundTag":"hcp-channel-no-version","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"}