lima-vm/lima · error
scp not found on host: %w
Error message
scp not found on host: %w
What it means
newSCPTool wraps exec.LookPath("scp"): when the OpenSSH scp client is absent from the host PATH, constructing the scp copy tool fails with this error. Like the rsync variant, it fails fast at tool construction rather than mid-copy.
Source
Thrown at pkg/copytool/scp.go:26
"errors"
"fmt"
"os/exec"
"github.com/coreos/go-semver/semver"
"github.com/lima-vm/lima/v2/pkg/limatype"
"github.com/lima-vm/lima/v2/pkg/sshutil"
)
type scpTool struct {
toolPath string
Options *Options
}
func newSCPTool(opts *Options) (*scpTool, error) {
path, err := exec.LookPath("scp")
if err != nil {
return nil, fmt.Errorf("scp not found on host: %w", err)
}
return &scpTool{toolPath: path, Options: opts}, nil
}
func (t *scpTool) Name() string {
return t.toolPath
}
func (t *scpTool) IsAvailableOnGuest(_ context.Context, _ []string) bool {
// scp is typically available on all systems with SSH
return true
}
func (t *scpTool) Command(ctx context.Context, paths []string, opts *Options) (*exec.Cmd, error) {
copyPaths, err := parseCopyPaths(ctx, paths)
if err != nil {
return nil, err
}View on GitHub (pinned to dd909d0973)
Solutions
- Install the OpenSSH client package (apt install openssh-client / dnf install openssh-clients / enable Windows OpenSSH Client feature).
- Verify `command -v scp` works in the same shell/environment that runs limactl.
- Fix PATH for the execution environment so scp's directory is included.
Example fix
// before: copytool.New fails because scp is absent
cpTool, err := copytool.New(ctx, inst, nil)
// after: install/verify scp first
if _, err := exec.LookPath("scp"); err != nil {
return fmt.Errorf("scp is required: %w; install openssh-client", err)
}
cpTool, err := copytool.New(ctx, inst, nil) Defensive patterns
Strategy: validation
Validate before calling
if _, err := exec.LookPath("scp"); err != nil {
return fmt.Errorf("prerequisite missing: install openssh-client (scp): %w", err)
} Try / catch
cpTool, err := copytool.New(ctx, inst, nil)
if err != nil && strings.Contains(err.Error(), "scp not found on host") {
return fmt.Errorf("install openssh-client to use scp copy: %w", err)
} Prevention
- Install openssh-client in base images and CI runners used for Lima.
- Verify `scp -V`-style availability (ssh -V) in environment smoke tests.
- On Windows, enable the OpenSSH Client optional feature before using limactl cp.
When it happens
Trigger: Calling copytool.New when `scp` is missing from the host PATH — e.g. no openssh-clients/openssh-client package installed, or running from an environment with a minimal PATH (cron, containers, IDE-launched processes).
Common situations: Fresh servers/CI images without openssh-clients; Windows hosts without OpenSSH client feature enabled; Docker containers running limactl with distroless-style images.
Related errors
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/a83fc5d9a13d0820.
Report an issue: GitHub.