{"record":{"id":"313f1818ff808cba","repo":"hashicorp/packer","slug":"no-hcp-packer-compatible-artifacts-were-found-for","errorCode":null,"errorMessage":"No HCP Packer-compatible artifacts were found for the build","messagePattern":"No HCP Packer-compatible artifacts were found for the build","errorType":"exception","errorClass":"NotAHCPArtifactError","httpStatus":null,"severity":"error","filePath":"internal/hcp/registry/types.bucket.go","lineNumber":804,"sourceCode":"\t\t\tlog.Printf(\"[WARN] - artifact %q failed to be decoded to an HCP artifact, this is probably because it is not compatible: %s\", art.BuilderId(), err)\n\t\t\tcontinue\n\t\t}\n\n\t\terr = bucket.UpdateArtifactForBuild(buildName, sdkImages...)\n\t\tif err != nil {\n\t\t\treturn packerSDKArtifacts, fmt.Errorf(\"failed to add artifact for %q: %s\", buildName, err)\n\t\t}\n\t}\n\n\tbuild, err := bucket.Version.Build(buildName)\n\tif err != nil {\n\t\treturn packerSDKArtifacts, fmt.Errorf(\n\t\t\t\"failed to get build %q from version being built. This is a Packer bug.\",\n\t\t\tbuildName)\n\t}\n\tif len(build.Artifacts) == 0 {\n\t\treturn packerSDKArtifacts, &NotAHCPArtifactError{\n\t\t\tfmt.Errorf(\"No HCP Packer-compatible artifacts were found for the build\"),\n\t\t}\n\t}\n\n\tfor _, sbom := range build.CompressedSboms {\n\t\terr = bucket.uploadSbom(ctx, buildName, sbom)\n\t\tif err != nil {\n\t\t\treturn packerSDKArtifacts, fmt.Errorf(\"Failed to upload sboms %s\", err)\n\t\t}\n\t}\n\n\tparErr := bucket.markBuildComplete(ctx, buildName)\n\tif parErr != nil {\n\t\treturn packerSDKArtifacts, fmt.Errorf(\n\t\t\t\"failed to update HCP Packer artifacts for %q: %s\",\n\t\t\tbuildName,\n\t\t\tparErr)\n\t}\n","sourceCodeStart":786,"sourceCodeEnd":822,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/internal/hcp/registry/types.bucket.go#L786-L822","documentation":"This error is returned by Bucket.doCompleteBuild when the build record fetched from HCP Packer has no artifacts registered. The registry wraps it in NotAHCPArtifactError to signal that none of the produced artifacts were HCP Packer-compatible, so there is nothing to publish for this build.","triggerScenarios":"doCompleteBuild fetches the build via bucket.getBuild and finds len(build.Artifacts)==0. This happens when the builder produced no artifacts, or when no artifact in the build registered itself as HCP-compatible (e.g. a null-builder or a builder that emits no registry Image).","commonSituations":"Running builds whose builders create no images (null builder, shell-only runs); using a custom/post-processor chain that strips artifacts; an HCP-visible build completing before any artifact was added via AddArtifactToBuild.","solutions":["Verify the build's builders actually produce artifacts and that no artifact-stripping post-processor (e.g. manifest-only chains) removes them","Check that each artifact implements the registry Image interface (valid ImageID/ProviderName) so it counts as HCP-compatible","If the build intentionally has no artifacts, do not enable HCP Packer integration for that build","Inspect the build in HCP Packer to confirm whether artifacts were expected; re-run the build if the builder silently failed"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before enabling HCP publishing for a template, ensure builders emit artifacts\nif len(artifactList) == 0 {\n    return fmt.Errorf(\"build %q produced no artifacts; HCP publishing requires at least one\", buildName)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not combine HCP Packer publishing with artifact-free builders (null builder)","Avoid post-processor chains that drop all artifacts before completion","Confirm each artifact registers as a registry Image (implements the HCP-compatible interface)"],"tags":["hcp-packer","artifacts","registry"],"backgroundTag":"no-hcp-compatible-artifacts","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"}