hashicorp/packer · error

failed to run scanner: %s

Error message

failed to run scanner: %s

What it means

Runtime error from provisionWithNativeGeneration: the SBOM scanner executed on the remote host failed or its result could not be retrieved. The wrapped error typically contains the remote exit status/stderr from running the scanner.

Source

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

	defer func() {
		if err := os.Remove(scannerZipPath); err != nil && !errors.Is(err, os.ErrNotExist) {
			log.Printf("[WARN] failed to remove temporary Packer release zip %s: %v", scannerZipPath, err)
		}
	}()

	// Step 2: Upload scanner to remote.
	log.Println("Uploading scanner to remote host...")
	remoteScannerPath, err := p.uploadScanner(ctx, ui, comm, scannerZipPath, osType)
	if err != nil {
		return fmt.Errorf("failed to upload scanner: %s", err)
	}
	defer p.cleanupRemoteFile(ctx, ui, comm, remoteScannerPath)

	// Step 3: Run scanner on remote
	ui.Say(fmt.Sprintf("Running scanner on remote host (scanning %s)...", p.config.ScanPath))
	remoteSBOMPath, err := p.runScanner(ctx, ui, comm, remoteScannerPath, osType)
	if err != nil {
		return fmt.Errorf("failed to run scanner: %s", err)
	}
	defer p.cleanupRemoteFile(ctx, ui, comm, remoteSBOMPath)

	// Step 4: Download SBOM from remote
	log.Println("Downloading SBOM from remote host...")
	sbomData, err := p.downloadSBOM(ctx, ui, comm, remoteSBOMPath)
	if err != nil {
		return fmt.Errorf("failed to download SBOM: %s", err)
	}

	// Step 5: Process SBOM for HCP (validate, compress, store)
	log.Println("Processing SBOM for HCP Packer...")
	if err := p.processSBOMForHCP(generatedData, sbomData); err != nil {
		return fmt.Errorf("failed to process SBOM: %s", err)
	}

	ui.Say("Automatic SBOM generation completed successfully")
	return nil

View on GitHub (pinned to eb36e3c3e4)

Solutions

  1. Inspect the included remote stderr for the scanner's failure reason
  2. Ensure the remote host has any runtime deps the scanner needs and retry
  3. Check disk space on the remote for scan output
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at provisioner/hcp-sbom/provisioner.go:651 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/090e7d79a8c8d7b4. Report an issue: GitHub.