hashicorp/packer · error

failed to upload scanner: %s

Error message

failed to upload scanner: %s

What it means

Runtime error from provisionWithNativeGeneration: after download and extraction, the scanner binary could not be uploaded to the remote machine (uploadScanner failed) — upload path/permission/connectivity problem reported via the communicator.

Source

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

	if mapped, ok := archMap[targetGOARCH]; ok {
		targetGOARCH = mapped
	}
	ui.Say(fmt.Sprintf("Downloading latest Packer release for %s/%s from %s...", targetGOOS, targetGOARCH, getReleaseBaseURL()))
	scannerZipPath, err := downloadPackerRelease(ctx, targetGOOS, targetGOARCH)
	if err != nil {
		return fmt.Errorf("failed to download Packer release for %s/%s: %w", targetGOOS, targetGOARCH, err)
	}
	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)
	}

View on GitHub (pinned to eb36e3c3e4)

Solutions

  1. Check the remote upload directory (default /tmp) is writable and not full
  2. Verify SSH/WinRM connectivity persists through the provision step and retry
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at provisioner/hcp-sbom/provisioner.go:643 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/36f3aff1e9462a0f. Report an issue: GitHub.