chenhg5/cc-connect · error

cloud_web: no reply context for session %q

Error message

cloud_web: no reply context for session %q

What it means

RefreshCard needs a stored reply context (chat_id/message_id pairs captured when the session last replied) to know which card to update. If lookupReplyCtx finds nothing for the given sessionKey, the card cannot be refreshed and this error is returned. Cards can only be refreshed for sessions that previously produced a message.

Source

Thrown at platform/cloud-web/cloudweb.go:523

	if !p.hasCap(capCard) {
		return p.Reply(ctx, rc, card.RenderText())
	}
	return p.sendWire(ctx, map[string]any{
		"type":        "card",
		"session_key": rc.SessionKey,
		"reply_ctx":   rc.ReplyCtx,
		"card":        serializeCard(card),
	})
}

func (p *Platform) ReplyCard(ctx context.Context, replyCtx any, card *core.Card) error {
	return p.SendCard(ctx, replyCtx, card)
}

func (p *Platform) RefreshCard(ctx context.Context, sessionKey string, card *core.Card) error {
	replyCtx, ok := p.lookupReplyCtx(sessionKey)
	if !ok {
		return fmt.Errorf("cloud_web: no reply context for session %q", sessionKey)
	}
	if !p.hasCap(capCard) {
		return p.Reply(ctx, replyContext{SessionKey: sessionKey, ReplyCtx: replyCtx}, card.RenderText())
	}
	return p.sendWire(ctx, map[string]any{
		"type":        "card",
		"session_key": sessionKey,
		"reply_ctx":   replyCtx,
		"card":        serializeCard(card),
	})
}

func (p *Platform) UpdateMessage(ctx context.Context, replyCtx any, content string) error {
	rc, err := parseReplyCtx(replyCtx)
	if err != nil {
		return err
	}
	if !p.hasCap(capUpdateMessage) {

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Only call RefreshCard after the session has sent at least one message that captured a reply context (e.g. after the first reply)
  2. Fall back to p.Send / SendCard for sessions without a stored context instead of refreshing
  3. Handle the error by logging and sending a normal message card rather than an in-place update
  4. Persist reply contexts if updates must survive restarts, or accept the loss and start a new message

Example fix

// before
if err := p.RefreshCard(ctx, key, card); err != nil { return err }

// after
if err := p.RefreshCard(ctx, key, card); err != nil {
    log.Warn("no reply ctx, sending new card", "err", err)
    return p.SendCard(ctx, fallbackCtx, card)
}
Defensive patterns

Strategy: fallback

Try / catch

if err := p.RefreshCard(ctx, key, card); err != nil {
    log.Warn("refresh failed, sending new card", "err", err)
    return p.SendCard(ctx, freshCtx, card)
}

Prevention

When it happens

Trigger: Calling p.RefreshCard(ctx, sessionKey, card) with a sessionKey that has never replied through this platform instance, or whose reply context was evicted/lost after restart.

Common situations: Streaming card updates started before the first assistant message established a reply context; process restart wiping the in-memory reply-context map while the engine still holds the old sessionKey; a session key typo or mismatched key format between agent and platform.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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