{"record":{"id":"1d481ff847153ea0","repo":"chenhg5/cc-connect","slug":"s","errorCode":null,"errorMessage":"%s","messagePattern":"%s","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/acp/session.go","lineNumber":131,"sourceCode":"\n\ts.cmd = cmd\n\ts.tr = newTransport(stdout, stdin, s.onNotification, s.onServerRequest)\n\n\tif err := cmd.Start(); err != nil {\n\t\tcancel()\n\t\treturn nil, fmt.Errorf(\"acp: start %s: %w\", cfg.command, err)\n\t}\n\n\ts.wg.Add(1)\n\tgo func() {\n\t\tdefer s.wg.Done()\n\t\ts.tr.readLoop(sessionCtx)\n\t\twaitErr := cmd.Wait()\n\t\tif waitErr != nil {\n\t\t\tmsg := stderrBuf.String()\n\t\t\tif msg != \"\" {\n\t\t\t\tslog.Error(\"acp: process exited\", \"error\", waitErr, \"stderr\", msg)\n\t\t\t\ts.emit(core.Event{Type: core.EventError, Error: fmt.Errorf(\"%s\", strings.TrimSpace(msg))})\n\t\t\t} else {\n\t\t\t\tslog.Debug(\"acp: process exited\", \"error\", waitErr)\n\t\t\t}\n\t\t}\n\t\ts.alive.Store(false)\n\t}()\n\n\tif err := s.handshake(cfg.resumeSessionID, cfg.authMethod); err != nil {\n\t\t_ = s.Close()\n\t\treturn nil, err\n\t}\n\n\t// Apply the agent-level mode preference now that we have a session\n\t// id. If set_mode fails (e.g. modeId unknown to this backend) we\n\t// log and carry on with whatever mode the server defaulted to —\n\t// the alternative would be to reject the session entirely, which\n\t// is worse UX for a non-critical control.\n\tif strings.TrimSpace(cfg.initialMode) != \"\" {","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/acp/session.go#L113-L149","documentation":"Not a thrown error but an event payload: when the ACP agent process exits with an error and its captured stderr is non-empty, the trimmed stderr text is emitted as a core.EventError using a trivial fmt.Errorf(\"%s\", msg). It surfaces the agent's own crash output to the messaging platform user.","triggerScenarios":"Thrown at agent/acp/session.go:131 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the stderr text — it comes from the agent process itself and states why it died","Address the agent-side issue (auth, flags, config, crash) and retry the turn","If stderr is unhelpful, run the agent CLI manually with the same arguments"],"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-14T11:17:12.474Z"}