chenhg5/cc-connect · error

%s

Error message

%s

What it means

In agent/reasonix, when the serve stream emits a 'turn_done' event carrying a non-empty Err string, the session stores it as s.errTurn and emits a core.EventResult with Done=true and that error. The string is formatted into an error with fmt.Errorf("%s", we.Err). This is how the reasonix agent surfaces a failed turn to the engine and ultimately to the messaging platform.

Source

Thrown at agent/reasonix/session.go:429

			qs = append(qs, core.UserQuestion{
				Question:    q.Prompt,
				Header:      q.Header,
				Options:     opts,
				MultiSelect: q.Multi,
			})
		}
		s.emit(core.Event{
			Type:      core.EventPermissionRequest,
			RequestID: we.Ask.ID,
			Questions: qs,
		})

	case "turn_done":
		s.flushThinking()
		s.inTurn.Store(false)
		s.mu.Lock()
		if we.Err != "" {
			s.errTurn = fmt.Errorf("%s", we.Err)
		}
		errTurn := s.errTurn
		s.mu.Unlock()

		s.emit(core.Event{Type: core.EventResult, Done: true, Error: errTurn})
		s.turnDone <- struct{}{}

	case "notice":
		s.flushThinking()
		s.emit(core.Event{Type: core.EventText, Content: "[Notice] " + we.Text})

	case "usage", "compaction_started", "compaction_done":
		// Informational, no user-visible event needed

	default:
		slog.Debug("reasonix: unhandled event", "kind", we.Kind)
	}
}

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Read the wrapped Err text in the emitted EventResult — it carries the reasonix-side failure message; fix the underlying agent issue it reports
  2. Check the reasonix serve process logs around the failing turn for a stack trace or exit reason
  3. Verify the reasonix serve endpoint is a compatible version and the model/config passed at session creation is valid
  4. Retry the turn; if it reproduces, reproduce with a minimal prompt to isolate agent-side vs request-side causes

Example fix

// engine side: surface the wrapped error to the user
if ev.Error != nil {
    reply := fmt.Sprintf("turn failed: %v", ev.Error)
    p.Reply(chatID, reply)
}
Defensive patterns

Strategy: try-catch

Try / catch

// Go: inspect the emitted event
for ev := range sess.Events() {
    if ev.Type == core.EventResult && ev.Error != nil {
        slog.Error("reasonix turn failed", "err", ev.Error)
        notifyUser(chatID, fmt.Sprintf("turn failed: %v", ev.Error))
    }
}

Prevention

When it happens

Trigger: The reasonix serve endpoint's SSE stream sends {"type":"turn_done","error":"..."} with a non-empty error field — i.e. the underlying reasonix agent process/turn failed after streaming started.

Common situations: Reasonix CLI crashed mid-turn, invalid model name, context window exceeded, agent-internal tool failure, or the serve process returned a turn-level error after partial output was already streamed to the user.

Related errors


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