{"record":{"id":"c71f8c9f00eab85b","repo":"abiosoft/colima","slug":"error-retrieving-lima-ssh-config-file-for-profile","errorCode":null,"errorMessage":"error retrieving Lima SSH config file for profile '%s': %w","messagePattern":"error retrieving Lima SSH config file for profile '(.+?)': %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"environment/vm/lima/limautil/ssh.go","lineNumber":63,"sourceCode":"\t\t\tline = \"Host \" + profileID\n\t\t}\n\n\t\t_, _ = fmt.Fprintln(&out, line)\n\t}\n\treturn out.String()\n}\n\nconst sshConfigFile = \"ssh.config\"\n\n// sshConfig is the ssh configuration file for a Colima profile.\ntype sshConfig string\n\n// Contents returns the content of the SSH config file.\nfunc (s sshConfig) Contents() (string, error) {\n\tprofile := config.ProfileFromName(string(s))\n\tb, err := os.ReadFile(s.File())\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error retrieving Lima SSH config file for profile '%s': %w\", strings.TrimPrefix(profile.DisplayName, \"lima\"), err)\n\t}\n\treturn string(b), nil\n}\n\n// File returns the path to the SSH config file.\nfunc (s sshConfig) File() string {\n\tprofile := config.ProfileFromName(string(s))\n\treturn filepath.Join(profile.LimaInstanceDir(), sshConfigFile)\n}\n","sourceCodeStart":45,"sourceCodeEnd":73,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/environment/vm/lima/limautil/ssh.go#L45-L73","documentation":"Error from sshConfig.Contents when os.ReadFile fails on the Lima-generated SSH config at <profile.LimaInstanceDir()>/ssh.config. The profile display name (minus the 'lima' prefix) is included to identify the instance.","triggerScenarios":"The ssh.config file does not exist because Lima creates it only when the instance is created/started; or it exists but is unreadable (permissions); or the instance directory was removed out-of-band.","commonSituations":"SSH-related commands run against a never-started or deleted profile; ~/.lima/colima/<profile> removed manually; files owned by root after sudo use; partially failed first start that never reached SSH setup.","solutions":["Confirm the file exists: ls ~/.lima/colima/<profile>/ssh.config (or the profile's LimaInstanceDir)","If absent, re-create the instance with 'colima start' — Lima regenerates ssh.config","Fix permissions/ownership of the instance directory if present but unreadable","For a broken half-created instance, 'colima delete' then 'colima start'"],"exampleFix":"# before: read fails, file missing\nls ~/.lima/colima/default/ssh.config   # No such file\n# after: regenerate by starting\ncolima start && ls ~/.lima/colima/default/ssh.config","handlingStrategy":"validation","validationCode":"// stat the exact file first\nfunc sshConfigPresent(profileID string) bool {\n    p := config.ProfileFromName(profileID)\n    _, err := os.Stat(filepath.Join(p.LimaInstanceDir(), \"ssh.config\"))\n    return err == nil\n}","typeGuard":null,"tryCatchPattern":"In Go: if _, err := os.Stat(file); errors.Is(err, fs.ErrNotExist) { trigger 'colima start' } else if err != nil { return err } before calling Contents().","preventionTips":["Never delete ~/.lima/colima/<profile> by hand; use 'colima delete' so all derived state goes together","If sudo was ever used, chown the Lima tree back to the user"],"tags":["ssh","filesystem","profile","not-found"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}