hashicorp/packer · error
the `bucket_name` must be specified
Error message
the `bucket_name` must be specified
What it means
Configuration validation guard in the hcp-packer-artifact datasource's Configure. The datasource queries HCP Packer for a build artifact, which requires knowing which bucket to look in; this sentinel error is appended to a MultiError when the required bucket_name field is empty or omitted from the datasource block. Set bucket_name in the datasource configuration to the HCP Packer bucket that holds the artifact.
Source
Thrown at datasource/hcp-packer-artifact/data.go:75
// For example, "amazon-ebs.example"
ComponentType string `mapstructure:"component_type" required:"false"`
}
func (d *Datasource) ConfigSpec() hcldec.ObjectSpec {
return d.config.FlatMapstructure().HCL2Spec()
}
func (d *Datasource) Configure(raws ...interface{}) error {
err := config.Decode(&d.config, nil, raws...)
if err != nil {
return err
}
var errs *packersdk.MultiError
if d.config.BucketName == "" {
errs = packersdk.MultiErrorAppend(
errs, fmt.Errorf("the `bucket_name` must be specified"),
)
}
// Ensure either channel_name or version_fingerprint is set, and not both at the same time.
if d.config.ChannelName == "" && d.config.VersionFingerprint == "" {
errs = packersdk.MultiErrorAppend(errs, errors.New(
"`version_fingerprint` or `channel_name` must be specified",
))
}
if d.config.ChannelName != "" && d.config.VersionFingerprint != "" {
errs = packersdk.MultiErrorAppend(errs, errors.New(
"`version_fingerprint` and `channel_name` cannot be specified together",
))
}
if d.config.Region == "" {
errs = packersdk.MultiErrorAppend(errs,
fmt.Errorf("the `region` must be specified"),View on GitHub (pinned to eb36e3c3e4)
Solutions
- Set bucket_name in the data block to your HCP Packer bucket name, e.g. bucket_name = "my-images"
- Verify the bucket exists in HCP Packer and copy its exact slug
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at datasource/hcp-packer-artifact/data.go:75 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/17be667f0e799876.
Report an issue: GitHub.