{"record":{"id":"381a050565f47fa4","repo":"chenhg5/cc-connect","slug":"s-381a05","errorCode":null,"errorMessage":"%s","messagePattern":"%s","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/cursor/session.go","lineNumber":189,"sourceCode":"}\n\nfunc (cs *cursorSession) readLoop(cmd *exec.Cmd, stdout io.ReadCloser, stderrBuf *bytes.Buffer) {\n\tdefer cs.wg.Done()\n\tdefer func() {\n\t\t// Close stdin so Cursor knows the input stream is finished.\n\t\tcs.stdinMu.Lock()\n\t\tif cs.stdin != nil {\n\t\t\t_ = cs.stdin.Close()\n\t\t\tcs.stdin = nil\n\t\t}\n\t\tcs.stdinMu.Unlock()\n\t}()\n\tdefer func() {\n\t\tif err := cmd.Wait(); err != nil {\n\t\t\tstderrMsg := strings.TrimSpace(stderrBuf.String())\n\t\t\tif stderrMsg != \"\" {\n\t\t\t\tslog.Error(\"cursorSession: process failed\", \"error\", err, \"stderr\", stderrMsg)\n\t\t\t\tevt := core.Event{Type: core.EventError, Error: fmt.Errorf(\"%s\", stderrMsg)}\n\t\t\t\tselect {\n\t\t\t\tcase cs.events <- evt:\n\t\t\t\tcase <-cs.ctx.Done():\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\tscanner := bufio.NewScanner(stdout)\n\tscanner.Buffer(make([]byte, 0, 64*1024), 10*1024*1024)\n\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tif line == \"\" {\n\t\t\tcontinue\n\t\t}\n","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/cursor/session.go#L171-L207","documentation":"An event payload: when the Cursor CLI process exits non-zero with non-empty stderr, the trimmed stderr text is emitted as core.EventError via fmt.Errorf(\"%s\", ...), relaying Cursor's own failure output to the messaging user.","triggerScenarios":"Thrown at agent/cursor/session.go:189 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the stderr text for Cursor's own failure reason","Fix the cause (auth, flags, workspace problems) and resend","Reproduce by running the cursor CLI manually with the same args"],"exampleFix":null,"handlingStrategy":"fallback","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"}