hashicorp/packer · error

failed to start remote step %q: %s

Error message

failed to start remote step %q: %s

What it means

Runtime error from runRemoteCmd in the hcp-sbom provisioner: the communicator failed to even start the remote command (e.g. uploading path prep, chmod, or the scanner invocation) — connection lost or the command couldn't be launched, before any exit code exists.

Source

Thrown at provisioner/hcp-sbom/provisioner.go:599

		if closeErr != nil {
			return nil, fmt.Errorf("failed to close %s stream from zip: %w", binaryName, closeErr)
		}
		return data, nil
	}

	return nil, fmt.Errorf("%s not found in zip %s", binaryName, zipPath)
}

// runRemoteCmd runs a single shell command on the remote host and returns a
// descriptive error if it fails.
func (p *Provisioner) runRemoteCmd(ctx context.Context, comm packersdk.Communicator, cmdStr, step string) error {
	var stderr bytes.Buffer
	cmd := &packersdk.RemoteCmd{
		Command: cmdStr,
		Stderr:  &stderr,
	}
	if err := comm.Start(ctx, cmd); err != nil {
		return fmt.Errorf("failed to start remote step %q: %s", step, err)
	}
	cmd.Wait()
	if cmd.ExitStatus() != 0 {
		return fmt.Errorf("remote step %q failed (exit %d): %s",
			step, cmd.ExitStatus(), strings.TrimSpace(stderr.String()))
	}
	return nil
}

// provisionWithNativeGeneration handles the native SBOM generation flow.
// The Packer release binary is downloaded on the host (works in air-gapped
// environments where the VM has no internet access), verified, then uploaded
// to the remote host via the communicator before running `packer sbom-generate`.
func (p *Provisioner) provisionWithNativeGeneration(
	ctx context.Context, ui packersdk.Ui, comm packersdk.Communicator,
	generatedData map[string]interface{}, osType, osArch string,
) error {
	ui.Say("Starting Automatic SBOM generation workflow...")

View on GitHub (pinned to eb36e3c3e4)

Solutions

  1. Check SSH/WinRM connectivity to the build machine and retry
  2. Verify the remote shell and target paths (e.g. /tmp) are usable
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at provisioner/hcp-sbom/provisioner.go:599 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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