{"record":{"id":"c8bd6c79ed842118","repo":"lima-vm/lima","slug":"failed-to-run-v-q-w-c8bd6c","errorCode":null,"errorMessage":"failed to run %v: %#q: %w","messagePattern":"failed to run (.+?): %#q: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/sshutil/sshutil.go","lineNumber":326,"sourceCode":"\t\t\t// no passphrase, no user@host comment\n\t\t\tprivPath := filepath.Join(configDir, filenames.UserPrivateKey)\n\t\t\tkeygenExe := \"ssh-keygen\"\n\t\t\tif runtime.GOOS == \"windows\" {\n\t\t\t\tsshExe, sshErr := NewSSHExe()\n\t\t\t\tif sshErr != nil {\n\t\t\t\t\treturn sshErr\n\t\t\t\t}\n\t\t\t\tkeygenExe = companionForSSH(sshExe, \"ssh-keygen\")\n\t\t\t\tprivPath, err = PathForSSH(ctx, sshExe, privPath)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\tkeygenCmd := exec.CommandContext(ctx, keygenExe, \"-t\", \"ed25519\", \"-q\", \"-N\", \"\",\n\t\t\t\t\"-C\", \"lima\", \"-f\", privPath)\n\t\t\tlogrus.Debugf(\"executing %v\", keygenCmd.Args)\n\t\t\tif out, err := keygenCmd.CombinedOutput(); err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to run %v: %#q: %w\", keygenCmd.Args, string(out), err)\n\t\t\t}\n\t\t\treturn nil\n\t\t}); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tentry, err := readPublicKey(filepath.Join(configDir, filenames.UserPublicKey))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tres := []PubKey{entry}\n\n\tif !loadDotSSH {\n\t\treturn res, nil\n\t}\n\n\t// Append all of ~/.ssh/*.pub\n\thomeDir, err := os.UserHomeDir()","sourceCodeStart":308,"sourceCodeEnd":344,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/sshutil/sshutil.go#L308-L344","documentation":"When generating the default key pair, Lima runs `ssh-keygen -t ed25519 -q -N \"\" -C lima -f <privPath>` and captures combined output; any non-zero exit is wrapped with the command args, its output, and the error. Commonly this is ssh-keygen missing from PATH or refusing to overwrite an existing key.","triggerScenarios":"DefaultPubKeys takes the _config directory lock and invokes ssh-keygen; the binary is absent, fails (e.g. target private key already exists without -y overwrite), or the OS cannot exec it.","commonSituations":"OpenSSH client tools not installed (minimal Windows or container images); corrupted/stale id-lima key files in _config confusing ssh-keygen; PATH not containing ssh-keygen; antivirus blocking execution on Windows.","solutions":["Install OpenSSH client tools so ssh-keygen is on PATH (apt install openssh-client / brew install openssh / enable Windows OpenSSH feature).","If the key files already exist but are broken, back them up and remove id-lima and id-lima.pub from $LIMA_HOME/_config, then retry.","Read the ssh-keygen output embedded in the error message for the exact failure reason.","Set the keygen path explicitly if Lima supports overriding it (LIMA_SSH_KEYGEN environment variable on some versions)."],"exampleFix":"// before\nwhich ssh-keygen  # not found\n// after\nsudo apt-get install -y openssh-client\nssh-keygen -t ed25519 -N \"\" -f ~/.lima/_config/user","handlingStrategy":"fallback","validationCode":"keygen, err := exec.LookPath(\"ssh-keygen\")\nif err != nil { return fmt.Errorf(\"openssh-keygen not installed: %w\", err) }","typeGuard":null,"tryCatchPattern":"keys, err := sshutil.DefaultPubKeys(ctx)\nif err != nil {\n    if strings.Contains(err.Error(), \"failed to run\") {\n        // surface embedded ssh-keygen output; prompt user to install openssh\n    }\n    return err\n}","preventionTips":["Install OpenSSH client tools in images/containers running limactl","Ensure ssh-keygen is on PATH for the running user","Remove stale/broken key files in _config before regeneration"],"tags":["ssh-keygen","exec","ssh-keys"],"backgroundTag":"ssh-keygen-exec-failed","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}