chenhg5/cc-connect · error

relay: agent process exited without response

Error message

relay: agent process exited without response

What it means

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.

Source

Thrown at core/engine.go:16099

			// Relay timed out. Let the agent finish its turn in the
			// background so the session state is saved cleanly and the
			// session remains resumable for the next relay call.
			go e.drainRelaySession(agentSession, session, sessions, agent.Name(), relaySessionKey)
			return relayPartialResponseOrError(ctx.Err(), textParts, fromProject, e.name)
		}
	}

	// Event channel closed without EventResult.
	agentSession.Close()

	if ctx.Err() != nil {
		return relayPartialResponseOrError(ctx.Err(), textParts, fromProject, e.name)
	}

	if len(textParts) > 0 {
		return strings.Join(textParts, ""), nil
	}
	return "", fmt.Errorf("relay: agent process exited without response")
}

func relayPartialResponseOrError(ctxErr error, textParts []string, fromProject, toProject string) (string, error) {
	if len(textParts) == 0 {
		return "", ctxErr
	}

	resp := strings.Join(textParts, "")
	slog.Warn("relay: context done before final result; returning partial response",
		"from", fromProject,
		"to", toProject,
		"error", ctxErr,
		"response_len", len(resp),
	)
	return resp, nil
}

// drainRelaySession runs in a goroutine after a relay timeout. It lets the

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Run the agent binary manually with the same arguments to confirm it starts and produces output
  2. Check engine logs for the agent process's stderr/exit code around the failure
  3. Verify the relay target agent name and command in config.toml point to a working agent
  4. Upgrade or reinstall the agent CLI binary

Example fix

// before: error is opaque
return "", fmt.Errorf("relay: agent process exited without response")
// after: include exit info if available
if exitErr, ok := err.(*exec.ExitError); ok {
    return "", fmt.Errorf("relay: agent process exited without response: %v", exitErr)
}
return "", fmt.Errorf("relay: agent process exited without response")
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-flight: verify agent binary runs and emits output
out, err := exec.Command(agentBin, "--version").CombinedOutput()
if err != nil { return fmt.Errorf("agent %s not runnable: %w", agentBin, err) }

Try / catch

resp, err := engine.Relay(ctx, from, to, msg)
if err != nil {
    if strings.Contains(err.Error(), "exited without response") {
        slog.Error("agent produced no output; check agent logs/binary", "err", err)
        // surface a user-facing fallback message
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "empty response", "returned no data", "empty embeddings": what HTTP 200-with-empty-body errors mean across libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/f9cb8bab6fa0d5c6. Report an issue: GitHub.