hashicorp/packer · error

could not find a build result matching [region=%q, platform=

Error message

could not find a build result matching [region=%q, platform=%q, component_type=%q]. Available: %v 

What it means

Returned after successfully fetching the version when no build artifact matches all three filters: region, platform, and (optional) component_type. The error lists the region/platform combinations actually found (cloudAndRegions), so you can see what exists. It signals a mismatch between the template's expected build output and the registry's actual contents.

Source

Thrown at datasource/hcp-packer-artifact/data.go:237

				// This is the desired artifact.
				output = DatasourceOutput{
					Platform:           build.Platform,
					ComponentType:      build.ComponentType,
					CreatedAt:          artifact.CreatedAt.String(),
					BuildID:            build.ID,
					VersionID:          build.VersionID,
					ChannelID:          channelID,
					PackerRunUUID:      build.PackerRunUUID,
					ExternalIdentifier: artifact.ExternalIdentifier,
					Region:             artifact.Region,
					Labels:             build.Labels,
				}
				return hcl2helper.HCL2ValueFromConfig(output, d.OutputSpec()), nil
			}
		}
	}

	return cty.NullVal(cty.EmptyObject), fmt.Errorf(
		"could not find a build result matching "+
			"[region=%q, platform=%q, component_type=%q]. Available: %v ",
		d.config.Region, d.config.Platform, d.config.ComponentType, cloudAndRegions,
	)
}

func filterBuildByComponentType(build *hcpPackerModels.HashicorpCloudPacker20230101Build, componentType string) bool {
	// optional field is not specified, passthrough
	if componentType == "" {
		return true
	}
	// if specified, only the matched artifact metadata is returned by this effect
	return build.ComponentType == componentType
}

View on GitHub (pinned to eb36e3c3e4)

Solutions

  1. Compare region/platform/component_type against the 'Available' map printed in the error and correct the datasource config.
  2. Ensure the publishing pipeline completed builds for the requested platform and region before this datasource runs.
  3. Remove or fix component_type (it is optional; empty matches any build).
  4. Publish the missing region/platform or run the consuming template in a region that exists.

Example fix

// before
data "hcp-packer-artifact" "foo" {
  bucket_name = "my-bucket"
  region = "us-west-2"      # build only produced us-east-1
  platform = "aws"
  component_type = "amazon-ebs"
}
// after (per Available: map[aws:[us-east-1]])
data "hcp-packer-artifact" "foo" {
  bucket_name = "my-bucket"
  region = "us-east-1"
  platform = "aws"
}
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the publishing build covered the requested region/platform/component_type:
if ! contains(publishedRegions, expectedRegion) {
    return fmt.Errorf("region %s was not produced by the publishing build", expectedRegion)
}

Prevention

When it happens

Trigger: The version contains builds but none has an artifact whose artifact.Region equals d.config.Region on a build whose Platform equals d.config.Platform with the requested component_type — e.g. the publishing build ran in a different region/platform, or the artifact for that region was never uploaded due to a partial build failure.

Common situations: Region queried with wrong format/casing ('us-east-1' vs 'USE1'); publishing template built only 'aws' but the consumer asks for 'azure'; component_type doesn't match the builder name recorded in the registry; incomplete publish run.

Related errors


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