{"record":{"id":"c990525430a6ddb3","repo":"hashicorp/packer","slug":"could-not-find-a-build-result-matching-region-q","errorCode":null,"errorMessage":"could not find a build result matching [region=%q, platform=%q, component_type=%q]. Available: %v ","messagePattern":"could not find a build result matching \\[region=%q, platform=%q, component_type=%q\\]\\. Available: (.+?) ","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"datasource/hcp-packer-artifact/data.go","lineNumber":237,"sourceCode":"\t\t\t\t// This is the desired artifact.\n\t\t\t\toutput = DatasourceOutput{\n\t\t\t\t\tPlatform:           build.Platform,\n\t\t\t\t\tComponentType:      build.ComponentType,\n\t\t\t\t\tCreatedAt:          artifact.CreatedAt.String(),\n\t\t\t\t\tBuildID:            build.ID,\n\t\t\t\t\tVersionID:          build.VersionID,\n\t\t\t\t\tChannelID:          channelID,\n\t\t\t\t\tPackerRunUUID:      build.PackerRunUUID,\n\t\t\t\t\tExternalIdentifier: artifact.ExternalIdentifier,\n\t\t\t\t\tRegion:             artifact.Region,\n\t\t\t\t\tLabels:             build.Labels,\n\t\t\t\t}\n\t\t\t\treturn hcl2helper.HCL2ValueFromConfig(output, d.OutputSpec()), nil\n\t\t\t}\n\t\t}\n\t}\n\n\treturn cty.NullVal(cty.EmptyObject), fmt.Errorf(\n\t\t\"could not find a build result matching \"+\n\t\t\t\"[region=%q, platform=%q, component_type=%q]. Available: %v \",\n\t\td.config.Region, d.config.Platform, d.config.ComponentType, cloudAndRegions,\n\t)\n}\n\nfunc filterBuildByComponentType(build *hcpPackerModels.HashicorpCloudPacker20230101Build, componentType string) bool {\n\t// optional field is not specified, passthrough\n\tif componentType == \"\" {\n\t\treturn true\n\t}\n\t// if specified, only the matched artifact metadata is returned by this effect\n\treturn build.ComponentType == componentType\n}\n","sourceCodeStart":219,"sourceCodeEnd":252,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/datasource/hcp-packer-artifact/data.go#L219-L252","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Compare region/platform/component_type against the 'Available' map printed in the error and correct the datasource config.","Ensure the publishing pipeline completed builds for the requested platform and region before this datasource runs.","Remove or fix component_type (it is optional; empty matches any build).","Publish the missing region/platform or run the consuming template in a region that exists."],"exampleFix":"// before\ndata \"hcp-packer-artifact\" \"foo\" {\n  bucket_name = \"my-bucket\"\n  region = \"us-west-2\"      # build only produced us-east-1\n  platform = \"aws\"\n  component_type = \"amazon-ebs\"\n}\n// after (per Available: map[aws:[us-east-1]])\ndata \"hcp-packer-artifact\" \"foo\" {\n  bucket_name = \"my-bucket\"\n  region = \"us-east-1\"\n  platform = \"aws\"\n}","handlingStrategy":"validation","validationCode":"// Confirm the publishing build covered the requested region/platform/component_type:\nif ! contains(publishedRegions, expectedRegion) {\n    return fmt.Errorf(\"region %s was not produced by the publishing build\", expectedRegion)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep publishing and consuming templates in sync on region/platform lists.","Use the 'Available:' map in this error to reconcile expected vs actual builds.","Only set component_type when you know the exact builder name recorded in the registry."],"tags":["hcp-packer","filter-mismatch","region","datasource"],"backgroundTag":"artifact-filter-no-match","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"}