{"record":{"id":"fe7f48aafff4267c","repo":"lima-vm/lima","slug":"failed-to-create-pipe-for-less-w","errorCode":null,"errorMessage":"failed to create pipe for less: %w","messagePattern":"failed to create pipe for less: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/shell.go","lineNumber":649,"sourceCode":"\t\t\t\tif !rsyncToTempDir {\n\t\t\t\t\tpaths := []string{\n\t\t\t\t\t\tremoteSource,\n\t\t\t\t\t\thostTmpDest,\n\t\t\t\t\t}\n\n\t\t\t\t\tif err := rsyncDirectory(ctx, cmd, rsync, paths); err != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"failed to sync back the changes from guest instance to host temporary directory: %w\", err)\n\t\t\t\t\t}\n\t\t\t\t\trsyncToTempDir = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpagerArgs := pagerCommand()\n\t\t\tlessCmd := exec.CommandContext(ctx, pagerArgs[0], pagerArgs[1:]...)\n\n\t\t\tpipeIn, err := lessCmd.StdinPipe()\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to create pipe for less: %w\", err)\n\t\t\t}\n\t\t\tif diffCmd != nil {\n\t\t\t\tdiffCmd.Stdout = pipeIn\n\t\t\t}\n\t\t\tlessCmd.Stdout = cmd.OutOrStdout()\n\t\t\tlessCmd.Stderr = cmd.OutOrStderr()\n\n\t\t\tif err := lessCmd.Start(); err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to start less: %w\", err)\n\t\t\t}\n\n\t\t\t// Write rsync dry-run output first\n\t\t\tif stats != nil {\n\t\t\t\trsyncHead := fmt.Sprintf(\"%s--- rsync dry-run statistics ---%s\", colorGray, colorNone)\n\t\t\t\tdiffHead := fmt.Sprintf(\"%s--- detailed diff --- %s\", colorGray, colorNone)\n\t\t\t\tif diffCmd == nil {\n\t\t\t\t\tdiffHead = fmt.Sprintf(\"%s--- detailed diff unavailable (`diff` not found) --- %s\", colorGray, colorNone)\n\t\t\t\t}","sourceCodeStart":631,"sourceCodeEnd":667,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/shell.go#L631-L667","documentation":"To display the change preview, limactl pipes `diff` output into the user's pager (usually `less`) via an os/exec StdinPipe. This error is returned when creating that pipe fails, which is rare and typically indicates process-resource exhaustion or an exec plumbing problem.","triggerScenarios":"Choosing \"View the changed contents\" in the TTY prompt, when lessCmd.StdinPipe() returns an error: file-descriptor exhaustion (too many open FDs/ulimit -n reached), fork/exec resource limits, or the process is in a constrained sandbox.","commonSituations":"Shell sessions with very high open-FD counts (many sockets/files); containers with low RLIMIT_NOFILE; heavily constrained CI runners; PAGER pointed at a wrapper that closes fds unpredictably (less likely, since the pipe is created before exec).","solutions":["Check and raise the file descriptor limit: `ulimit -n` (raise via `ulimit -n 4096` or limits.conf).","Close leaked FDs in the parent environment or restart the shell session to release resources.","Skip the preview: choose \"Yes\" or \"No\" at the prompt instead of \"View the changed contents\".","Retry the command after freeing system resources."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"ulimit -n | awk '{exit ($1 < 1024 ? 1 : 0)}' && echo 'fd limit OK' || echo 'raise ulimit -n before running limactl shell'","typeGuard":null,"tryCatchPattern":"// pre-flight: raise soft fd limit if low\nulimit -n 4096 2>/dev/null || true\nlimactl shell default","preventionTips":["Raise RLIMIT_NOFILE if you run many fd-heavy workloads.","Avoid leaking file descriptors in wrapper scripts around limactl.","Choose Yes/No at the prompt if preview infrastructure is constrained.","Restart stale shells/sessions to release resources."],"tags":["pager","exec","file-descriptors"],"backgroundTag":"pipe-creation-failed","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}