{"record":{"id":"f8912af0a7d12504","repo":"chenhg5/cc-connect","slug":"cursorsession-stdout-pipe-w","errorCode":null,"errorMessage":"cursorSession: stdout pipe: %w","messagePattern":"cursorSession: stdout pipe: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/cursor/session.go","lineNumber":145,"sourceCode":"\t}\n\tif cs.model != \"\" {\n\t\targs = append(args, \"--model\", cs.model)\n\t}\n\targs = append(args, \"--workspace\", cs.workDir, \"--\", prompt)\n\n\tslog.Debug(\"cursorSession: launching\", \"resume\", isResume, \"args\", core.RedactArgs(args))\n\n\tcmd := exec.CommandContext(cs.ctx, cs.cmd, args...)\n\tcmd.Dir = cs.workDir\n\tenv := os.Environ()\n\tif len(cs.extraEnv) > 0 {\n\t\tenv = core.MergeEnv(env, cs.extraEnv)\n\t}\n\tcmd.Env = env\n\n\tstdout, err := cmd.StdoutPipe()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cursorSession: stdout pipe: %w\", err)\n\t}\n\n\t// Set up a stdin pipe so we can write interaction_query responses back to Cursor.\n\t// Without a connected stdin, Cursor gets EOF and auto-rejects all permission requests.\n\tstdin, err := cmd.StdinPipe()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cursorSession: stdin pipe: %w\", err)\n\t}\n\n\tvar stderrBuf bytes.Buffer\n\tcmd.Stderr = &stderrBuf\n\n\tif err := cmd.Start(); err != nil {\n\t\t_ = stdin.Close()\n\t\treturn fmt.Errorf(\"cursorSession: start: %w\", err)\n\t}\n\n\tcs.stdinMu.Lock()","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/cursor/session.go#L127-L163","documentation":"Wraps a failed exec.Cmd.StdoutPipe() in cursorSession.Send while preparing the Cursor CLI subprocess for a turn. Pre-spawn pipe allocation failure — nearly always OS fd exhaustion rather than anything Cursor-related.","triggerScenarios":"Thrown at agent/cursor/session.go:145 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Raise the file-descriptor limit (ulimit -n)","Lower concurrency of cursor sessions","Investigate fd leaks in the long-running daemon"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}