{"record":{"id":"a83fc5d9a13d0820","repo":"lima-vm/lima","slug":"scp-not-found-on-host-w","errorCode":null,"errorMessage":"scp not found on host: %w","messagePattern":"scp not found on host: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/copytool/scp.go","lineNumber":26,"sourceCode":"\t\"errors\"\n\t\"fmt\"\n\t\"os/exec\"\n\n\t\"github.com/coreos/go-semver/semver\"\n\n\t\"github.com/lima-vm/lima/v2/pkg/limatype\"\n\t\"github.com/lima-vm/lima/v2/pkg/sshutil\"\n)\n\ntype scpTool struct {\n\ttoolPath string\n\tOptions  *Options\n}\n\nfunc newSCPTool(opts *Options) (*scpTool, error) {\n\tpath, err := exec.LookPath(\"scp\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"scp not found on host: %w\", err)\n\t}\n\treturn &scpTool{toolPath: path, Options: opts}, nil\n}\n\nfunc (t *scpTool) Name() string {\n\treturn t.toolPath\n}\n\nfunc (t *scpTool) IsAvailableOnGuest(_ context.Context, _ []string) bool {\n\t// scp is typically available on all systems with SSH\n\treturn true\n}\n\nfunc (t *scpTool) Command(ctx context.Context, paths []string, opts *Options) (*exec.Cmd, error) {\n\tcopyPaths, err := parseCopyPaths(ctx, paths)\n\tif err != nil {\n\t\treturn nil, err\n\t}","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/copytool/scp.go#L8-L44","documentation":"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.","triggerScenarios":"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).","commonSituations":"Fresh servers/CI images without openssh-clients; Windows hosts without OpenSSH client feature enabled; Docker containers running limactl with distroless-style images.","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."],"exampleFix":"// before: copytool.New fails because scp is absent\ncpTool, err := copytool.New(ctx, inst, nil)\n// after: install/verify scp first\nif _, err := exec.LookPath(\"scp\"); err != nil {\n    return fmt.Errorf(\"scp is required: %w; install openssh-client\", err)\n}\ncpTool, err := copytool.New(ctx, inst, nil)","handlingStrategy":"validation","validationCode":"if _, err := exec.LookPath(\"scp\"); err != nil {\n    return fmt.Errorf(\"prerequisite missing: install openssh-client (scp): %w\", err)\n}","typeGuard":null,"tryCatchPattern":"cpTool, err := copytool.New(ctx, inst, nil)\nif err != nil && strings.Contains(err.Error(), \"scp not found on host\") {\n    return fmt.Errorf(\"install openssh-client to use scp copy: %w\", err)\n}","preventionTips":["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."],"tags":["scp","openssh","host-environment","dependency-missing"],"backgroundTag":"command-not-found","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}