{"record":{"id":"f9cb8bab6fa0d5c6","repo":"chenhg5/cc-connect","slug":"relay-agent-process-exited-without-response","errorCode":null,"errorMessage":"relay: agent process exited without response","messagePattern":"relay: agent process exited without response","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/engine.go","lineNumber":16099,"sourceCode":"\t\t\t// Relay timed out. Let the agent finish its turn in the\n\t\t\t// background so the session state is saved cleanly and the\n\t\t\t// session remains resumable for the next relay call.\n\t\t\tgo e.drainRelaySession(agentSession, session, sessions, agent.Name(), relaySessionKey)\n\t\t\treturn relayPartialResponseOrError(ctx.Err(), textParts, fromProject, e.name)\n\t\t}\n\t}\n\n\t// Event channel closed without EventResult.\n\tagentSession.Close()\n\n\tif ctx.Err() != nil {\n\t\treturn relayPartialResponseOrError(ctx.Err(), textParts, fromProject, e.name)\n\t}\n\n\tif len(textParts) > 0 {\n\t\treturn strings.Join(textParts, \"\"), nil\n\t}\n\treturn \"\", fmt.Errorf(\"relay: agent process exited without response\")\n}\n\nfunc relayPartialResponseOrError(ctxErr error, textParts []string, fromProject, toProject string) (string, error) {\n\tif len(textParts) == 0 {\n\t\treturn \"\", ctxErr\n\t}\n\n\tresp := strings.Join(textParts, \"\")\n\tslog.Warn(\"relay: context done before final result; returning partial response\",\n\t\t\"from\", fromProject,\n\t\t\"to\", toProject,\n\t\t\"error\", ctxErr,\n\t\t\"response_len\", len(resp),\n\t)\n\treturn resp, nil\n}\n\n// drainRelaySession runs in a goroutine after a relay timeout. It lets the","sourceCodeStart":16081,"sourceCodeEnd":16117,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/engine.go#L16081-L16117","documentation":"This error is returned by the relay path in core/engine.go when an agent process terminated without ever emitting any text output. The relay function collects text parts from the agent's event stream; if the process exits (or the stream ends) and textParts is empty, there is nothing to forward to the target project, so the engine reports that the agent produced no response instead of returning an empty string.","triggerScenarios":"The relayed agent process exits immediately (crash, bad binary, invalid arguments), terminates before emitting any output events, or the event stream closes without any text parts while no context cancellation occurred (ctx.Err() == nil) and textParts is empty.","commonSituations":"Agent CLI binary not installed or fails on startup; relay target configured with wrong agent name; agent crashes due to invalid prompt or config; out-of-memory or signal kill during startup before first token; agent version change altered output protocol so no text events are parsed.","solutions":["Run the agent binary manually with the same arguments to confirm it starts and produces output","Check engine logs for the agent process's stderr/exit code around the failure","Verify the relay target agent name and command in config.toml point to a working agent","Upgrade or reinstall the agent CLI binary"],"exampleFix":"// before: error is opaque\nreturn \"\", fmt.Errorf(\"relay: agent process exited without response\")\n// after: include exit info if available\nif exitErr, ok := err.(*exec.ExitError); ok {\n    return \"\", fmt.Errorf(\"relay: agent process exited without response: %v\", exitErr)\n}\nreturn \"\", fmt.Errorf(\"relay: agent process exited without response\")","handlingStrategy":"try-catch","validationCode":"// pre-flight: verify agent binary runs and emits output\nout, err := exec.Command(agentBin, \"--version\").CombinedOutput()\nif err != nil { return fmt.Errorf(\"agent %s not runnable: %w\", agentBin, err) }","typeGuard":null,"tryCatchPattern":"resp, err := engine.Relay(ctx, from, to, msg)\nif err != nil {\n    if strings.Contains(err.Error(), \"exited without response\") {\n        slog.Error(\"agent produced no output; check agent logs/binary\", \"err\", err)\n        // surface a user-facing fallback message\n    }\n    return err\n}","preventionTips":["Health-check the agent binary at startup (e.g. cc-connect doctor / --version)","Pin and monitor the agent CLI version","Log agent stderr to a file so empty-output exits are diagnosable","Add a startup smoke test that relays a trivial prompt"],"tags":["relay","agent-process","empty-output"],"backgroundTag":"empty-api-response","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"}