{"record":{"id":"7ba068feb6b11e41","repo":"hashicorp/packer","slug":"remote-step-q-failed-exit-d-s","errorCode":null,"errorMessage":"remote step %q failed (exit %d): %s","messagePattern":"remote step %q failed \\(exit (.+?)\\): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"provisioner/hcp-sbom/provisioner.go","lineNumber":603,"sourceCode":"\t}\n\n\treturn nil, fmt.Errorf(\"%s not found in zip %s\", binaryName, zipPath)\n}\n\n// runRemoteCmd runs a single shell command on the remote host and returns a\n// descriptive error if it fails.\nfunc (p *Provisioner) runRemoteCmd(ctx context.Context, comm packersdk.Communicator, cmdStr, step string) error {\n\tvar stderr bytes.Buffer\n\tcmd := &packersdk.RemoteCmd{\n\t\tCommand: cmdStr,\n\t\tStderr:  &stderr,\n\t}\n\tif err := comm.Start(ctx, cmd); err != nil {\n\t\treturn fmt.Errorf(\"failed to start remote step %q: %s\", step, err)\n\t}\n\tcmd.Wait()\n\tif cmd.ExitStatus() != 0 {\n\t\treturn fmt.Errorf(\"remote step %q failed (exit %d): %s\",\n\t\t\tstep, cmd.ExitStatus(), strings.TrimSpace(stderr.String()))\n\t}\n\treturn nil\n}\n\n// provisionWithNativeGeneration handles the native SBOM generation flow.\n// The Packer release binary is downloaded on the host (works in air-gapped\n// environments where the VM has no internet access), verified, then uploaded\n// to the remote host via the communicator before running `packer sbom-generate`.\nfunc (p *Provisioner) provisionWithNativeGeneration(\n\tctx context.Context, ui packersdk.Ui, comm packersdk.Communicator,\n\tgeneratedData map[string]interface{}, osType, osArch string,\n) error {\n\tui.Say(\"Starting Automatic SBOM generation workflow...\")\n\n\t// Step 1: Download Packer release binary on the host.\n\ttargetGOOS := strings.ToLower(osType)\n\tarchMap := map[string]string{","sourceCodeStart":585,"sourceCodeEnd":621,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/provisioner/hcp-sbom/provisioner.go#L585-L621","documentation":"Runtime error from runRemoteCmd: the remote command started but exited non-zero; the message includes the step label, exit code, and captured stderr from the remote host, so the actual failure text comes from the remote command itself.","triggerScenarios":"Thrown at provisioner/hcp-sbom/provisioner.go:603 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the stderr in the message — it is the remote command's own error output","For chmod/exec failures, check that /tmp on the remote host is not mounted noexec","Verify the scanner binary matches the remote OS/architecture"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}