{"record":{"id":"9886be3b0c5a0bda","repo":"lima-vm/lima","slug":"field-user-shell-must-be-one-of-v-for-windows-g","errorCode":null,"errorMessage":"field `user.shell` must be one of %v for Windows guest, got %#q","messagePattern":"field `user\\.shell` must be one of (.+?) for Windows guest, got %#q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/limayaml/validate.go","lineNumber":71,"sourceCode":"\tcase limatype.WINDOWS:\n\t\tif *y.VMType != limatype.QEMU {\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"currently Windows guest is only supported on %#q; got %#q\", limatype.QEMU, *y.VMType))\n\t\t}\n\t\tif !slices.Contains([]limatype.Arch{limatype.X8664, limatype.AARCH64}, *y.Arch) {\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"currently Windows guest is only supported on [%#q, %#q]; got %#q\", limatype.X8664, limatype.AARCH64, *y.Arch))\n\t\t}\n\tdefault:\n\t\terrs = errors.Join(errs, fmt.Errorf(\"field `os` must be one of %#q; got %#q\", limatype.OSTypes, *y.OS))\n\t}\n\tif !slices.Contains(limatype.ArchTypes, *y.Arch) {\n\t\terrs = errors.Join(errs, fmt.Errorf(\"field `arch` must be one of %v; got %#q\", limatype.ArchTypes, *y.Arch))\n\t}\n\n\tif y.User.Shell != nil {\n\t\tshell := *y.User.Shell\n\t\tif *y.OS == limatype.WINDOWS {\n\t\t\tif !IsSupportedWindowsShell(shell) {\n\t\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `user.shell` must be one of %v for Windows guest, got %#q\", SupportedWindowsShells, shell))\n\t\t\t}\n\t\t} else if !path.IsAbs(shell) {\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `user.shell` must be an absolute path, got %#q\", shell))\n\t\t}\n\t}\n\n\tif len(y.Images) == 0 {\n\t\terrs = errors.Join(errs, errors.New(\"field `images` must be set\"))\n\t}\n\tfor i, f := range y.Images {\n\t\terr := validateFileObject(f.File, fmt.Sprintf(\"images[%d]\", i))\n\t\tif err != nil {\n\t\t\terrs = errors.Join(errs, err)\n\t\t}\n\t\tif f.Kernel != nil {\n\t\t\terr := validateFileObject(f.Kernel.File, fmt.Sprintf(\"images[%d].kernel\", i))\n\t\t\tif err != nil {\n\t\t\t\terrs = errors.Join(errs, err)","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/limayaml/validate.go#L53-L89","documentation":"When `os: windows`, the optional `user.shell` must be one of the shells Lima supports on Windows guests (SupportedWindowsShells, e.g. cmd/powershell-style entries) rather than an arbitrary absolute path. Validate() rejects any other value.","triggerScenarios":"Template sets `os: windows` and `user.shell` to a POSIX path like /bin/bash or a shell not in SupportedWindowsShells.","commonSituations":"Reusing a Linux template's shell setting after switching the guest to Windows; assuming the absolute-path rule applies on Windows too.","solutions":["Set `user.shell` to one of the listed SupportedWindowsShells values","Remove the `user.shell` line so the guest default shell is used","Switch `os` back to linux/darwin/freebsd if a POSIX shell was intended"],"exampleFix":"// before\nos: windows\nuser:\n  shell: /bin/bash\n// after\nos: windows\nuser:\n  shell: powershell.exe","handlingStrategy":"validation","validationCode":"func validShellForOS(os, shell string) bool {\n\tif os != \"windows\" {\n\t\treturn shell == \"\" || path.IsAbs(shell)\n\t}\n\treturn shell == \"\" || limayaml.IsSupportedWindowsShell(shell)\n}","typeGuard":"func isSupportedWindowsShell(s string) bool {\n\treturn slices.Contains(limayaml.SupportedWindowsShells, s)\n}","tryCatchPattern":"if err := limayaml.Validate(y, false); err != nil {\n\tif strings.Contains(err.Error(), \"user.shell must be one of\") {\n\t\treturn fmt.Errorf(\"unsupported Windows shell: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Only set user.shell on Windows templates with values from SupportedWindowsShells","Omit user.shell to accept the guest default","Re-check shell settings when switching a template between linux and windows"],"tags":["lima","windows-guest","shell","config-validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}