{"record":{"id":"0f73b4ca9e62b1a5","repo":"hashicorp/packer","slug":"packer-destination-path-missing-from-configs-this","errorCode":null,"errorMessage":"packer destination path missing from configs: this is an internal error","messagePattern":"packer destination path missing from configs: this is an internal error","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"provisioner/hcp-sbom/provisioner.go","lineNumber":887,"sourceCode":"\n\tcmd.Wait()\n\tif cmd.ExitStatus() != 0 {\n\t\tui.Error(fmt.Sprintf(\"Cleanup command failed for %s with exit status %d\", remotePath, cmd.ExitStatus()))\n\t}\n}\n\n// processSBOMForHCP validates, compresses, and prepares SBOM for HCP upload\nfunc (p *Provisioner) processSBOMForHCP(generatedData map[string]interface{}, sbomData []byte) error {\n\t// Validate SBOM format\n\tformat, err := validateSBOM(sbomData)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"SBOM validation failed: %s\", err)\n\t}\n\n\t// Get destination path from generatedData\n\tpkrDst, ok := generatedData[\"dst\"].(string)\n\tif !ok || pkrDst == \"\" {\n\t\treturn fmt.Errorf(\"packer destination path missing from configs: this is an internal error\")\n\t}\n\n\t// Write PackerSBOM to destination\n\toutFile, err := os.Create(pkrDst)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create output file %q: %s\", pkrDst, err)\n\t}\n\tdefer func() {\n\t\t_ = outFile.Close() // Cleanup, ignore error\n\t}()\n\n\terr = json.NewEncoder(outFile).Encode(PackerSBOM{\n\t\tRawSBOM: sbomData,\n\t\tFormat:  format,\n\t\tName:    p.config.SbomName,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to write SBOM to %q: %s\", pkrDst, err)","sourceCodeStart":869,"sourceCodeEnd":905,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/provisioner/hcp-sbom/provisioner.go#L869-L905","documentation":"Returned by processSBOMForHCP (provisioner/hcp-sbom/provisioner.go:887) when the generatedData map passed into the provisioner lacks a usable \"dst\" string key holding the local Packer SBOM destination path. The message explicitly labels it an internal error: callers (provisionWithExistingSBOM / provisionWithNativeGeneration) are expected to always populate this key, so hitting it indicates a Packer plumbing bug or a non-standard invocation.","triggerScenarios":"processSBOMForHCP is invoked with a generatedData map where generatedData[\"dst\"] is absent, nil, or not a string — e.g. an internal refactor/regression in the provisioner, or calling the provisioner through custom code that builds generatedData manually instead of via the normal Provision path.","commonSituations":"Running a patched or forked Packer binary where the SBOM config plumbing changed; a genuine upstream bug in a specific version; embedding/invoking this provisioner programmatically with a hand-built data map; type assertion failing because dst was stored under a different key or as a non-string type.","solutions":["Upgrade to the latest Packer release — if the stock binary hits this, it is a bug worth reporting with PACKER_LOG=1 output.","If you run a forked/patched build, diff your changes against upstream for the code that populates generatedData[\"dst\"].","If invoking programmatically, ensure the map contains a non-empty string at key \"dst\" before calling processSBOMForHCP.","Reproduce with an unmodified `packer build` and minimal template to rule out local modifications.","Check the provisioner's own generatedData construction (Provision path) for regressions if you maintain a fork."],"exampleFix":"// before (custom caller): map missing dst\ndata := map[string]interface{}{\"src\": srcPath}\nerr := p.processSBOMForHCP(data, sbomData)\n// after: provide the required destination key\ndata := map[string]interface{}{\"src\": srcPath, \"dst\": dstPath}\nerr := p.processSBOMForHCP(data, sbomData)","handlingStrategy":"validation","validationCode":"// Guard before calling processing (or when embedding the provisioner)\ndst, ok := generatedData[\"dst\"].(string)\nif !ok || dst == \"\" { /* internal plumbing broken: fail fast with context */ }","typeGuard":"func hasDst(generatedData map[string]interface{}) (string, bool) {\n    dst, ok := generatedData[\"dst\"].(string)\n    return dst, ok && dst != \"\"\n}","tryCatchPattern":"if err := p.processSBOMForHCP(generatedData, sbomData); err != nil {\n    if strings.Contains(err.Error(), \"internal error\") { /* upgrade Packer / file bug */ }\n    return err\n}","preventionTips":["Use stock, current Packer releases — this path should be unreachable in normal builds.","If forking, keep the generatedData[\"dst\"] population intact when refactoring.","When invoking programmatically, always set a non-empty string \"dst\" key.","Reproduce with a minimal unmodified template before assuming a bug."],"tags":["packer","sbom","internal-error","provisioner"],"backgroundTag":"missing-internal-config-key","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"}