{"record":{"id":"6be6055dc43a2a05","repo":"chenhg5/cc-connect","slug":"cursorsession-stdin-pipe-w","errorCode":null,"errorMessage":"cursorSession: stdin pipe: %w","messagePattern":"cursorSession: stdin pipe: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/cursor/session.go","lineNumber":152,"sourceCode":"\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()\n\tcs.stdin = stdin\n\tcs.stdinMu.Unlock()\n\n\tcs.wg.Add(1)\n\tgo cs.readLoop(cmd, stdout, &stderrBuf)\n\n\treturn nil","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/cursor/session.go#L134-L170","documentation":"Wraps a failed exec.Cmd.StdinPipe() in cursorSession.Send. The stdin pipe is mandatory for Cursor: it carries interaction_query permission responses, and without it Cursor sees EOF and auto-rejects permissions. Pre-spawn failure indicates fd exhaustion.","triggerScenarios":"Thrown at agent/cursor/session.go:152 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Raise the file-descriptor limit","Reduce concurrent sessions","Investigate fd leaks in the daemon process"],"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"}