{"record":{"id":"60b65af9e09d88c5","repo":"lima-vm/lima","slug":"failed-to-construct-wsl-boot-sh-script-w","errorCode":null,"errorMessage":"failed to construct wsl boot.sh script: %w","messagePattern":"failed to construct wsl boot\\.sh script: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/driver/wsl2/vm_windows.go","lineNumber":83,"sourceCode":"\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to run `wsl.exe --terminate %s`: %w (out=%#q)\",\n\t\t\tdistroName, err, out)\n\t}\n\treturn nil\n}\n\n//go:embed lima-init.TEMPLATE\nvar limaBoot string\n\n// provisionVM starts Lima's boot process inside an already imported VM.\nfunc provisionVM(ctx context.Context, instanceDir, instanceName, distroName string, errCh chan<- error) error {\n\tciDataPath := filepath.Join(instanceDir, filenames.CIDataISODir)\n\tm := map[string]string{\n\t\t\"CIDataPath\": ciDataPath,\n\t}\n\tlimaBootB, err := textutil.ExecuteTemplate(limaBoot, m)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to construct wsl boot.sh script: %w\", err)\n\t}\n\tlimaBootFile, err := os.CreateTemp(\"\", \"lima-wsl2-boot-*.sh\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, err = limaBootFile.Write(limaBootB); err != nil {\n\t\tlimaBootFile.Close()\n\t\treturn err\n\t}\n\tlimaBootFileWinPath := limaBootFile.Name()\n\tif err = limaBootFile.Close(); err != nil {\n\t\treturn err\n\t}\n\t// path should be quoted and use \\\\ as separator\n\tbootFileWSLPath := strconv.Quote(limaBootFileWinPath)\n\tlimaBootFilePathOnLinuxB, err := exec.CommandContext(\n\t\tctx,\n\t\t\"wsl.exe\",","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/driver/wsl2/vm_windows.go#L65-L101","documentation":"provisionVM renders the lima boot.sh script from a Go template (with CIDataPath substituted) using textutil.ExecuteTemplate. If template execution fails, this error wraps the underlying cause. It indicates the boot script could not be generated before it is written to a temp file and run inside WSL.","triggerScenarios":"Start() -> provisionVM when ExecuteTemplate returns an error — malformed/empty template asset, missing embedded limaBoot template, or writer failure during execution.","commonSituations":"Corrupted or modified Lima installation (embedded template assets missing/empty); template syntax broken in a custom build; template referencing unknown map keys if the map contract changed between Lima versions.","solutions":["Reinstall/repair Lima — the embedded template asset may be corrupted in the build","Rebuild Lima from source cleanly (`make`) if using a self-compiled binary","Check the wrapped err for the exact template parse/execute failure and fix the template if it's a custom build","Update to a matching version of limactl and guest components (mixed-version installs can change template contracts)"],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := driver.Start(ctx); err != nil {\n    if strings.Contains(err.Error(), \"failed to construct wsl boot.sh\") {\n        return fmt.Errorf(\"lima installation damaged (template render failed): %w; reinstall lima\", err)\n    }\n    return err\n}","preventionTips":["Install Lima from official releases; avoid hand-patched binaries","Keep limactl and guest components on matching versions","Verify installs with `limactl --version` and a smoke-test start","Rebuild cleanly (`make clean && make`) if self-compiling"],"tags":["wsl2","windows","template","provisioning"],"backgroundTag":"template-execution-failed","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}