chenhg5/cc-connect · error

cloud_web: no stored reply context for session %q

Error message

cloud_web: no stored reply context for session %q

What it means

The transport supports reconstruction (capability present), but lookupReplyCtx has no stored reply context for this sessionKey — the session never replied through this platform instance or its context was lost. Reconstruction requires previously captured chat/message identifiers.

Source

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

	if !p.hasCap(capAudio) {
		return core.ErrNotSupported
	}
	return p.sendWire(ctx, map[string]any{
		"type":        "audio",
		"session_key": rc.SessionKey,
		"reply_ctx":   rc.ReplyCtx,
		"data":        base64.StdEncoding.EncodeToString(audio),
		"format":      format,
	})
}

func (p *Platform) ReconstructReplyCtx(sessionKey string) (any, error) {
	if !p.hasCap(capReconstructReply) {
		return nil, fmt.Errorf("cloud_web: reconstruct_reply not supported by gateway")
	}
	replyCtx, ok := p.lookupReplyCtx(sessionKey)
	if !ok {
		return nil, fmt.Errorf("cloud_web: no stored reply context for session %q", sessionKey)
	}
	return replyContext{SessionKey: sessionKey, ReplyCtx: replyCtx}, nil
}

func (p *Platform) sendWire(ctx context.Context, msg map[string]any) error {
	if ctx == nil {
		ctx = context.Background()
	}
	return p.tp.Send(ctx, msg)
}

func parseReplyCtx(v any) (replyContext, error) {
	switch rc := v.(type) {
	case replyContext:
		return rc, nil
	case *replyContext:
		if rc == nil {
			return replyContext{}, fmt.Errorf("cloud_web: nil reply context")

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Ensure the session has exchanged at least one message through this platform instance before reconstructing
  2. Treat the error as a cache miss: start a new reply (Send) for the session instead
  3. Fix sessionKey construction so it matches the key used at reply time (compare formats/prefixes)
  4. Persist reply contexts across restarts if reconstruction after restart is a requirement

Example fix

// before
rc, err := p.ReconstructReplyCtx(key)
if err != nil { return err }

// after
rc, err := p.ReconstructReplyCtx(key)
if err != nil {
    log.Info("no stored reply ctx; starting fresh", "key", key)
    return p.Send(ctx, nil, prompt)
}
Defensive patterns

Strategy: fallback

Validate before calling

// verify the session replied before restoring
if !p.HasReplyContext(sessionKey) { return ErrStartFresh }

Try / catch

rc, err := p.ReconstructReplyCtx(key)
if err != nil {
    log.Info("reply ctx missing; starting fresh session")
    return startFreshSession(key)
}

Prevention

When it happens

Trigger: Calling p.ReconstructReplyCtx(sessionKey) where the platform's reply-context store contains no entry for that exact key (never replied, restart wiped in-memory map, or key format mismatch).

Common situations: Daemon restart discarding in-memory reply contexts while the engine tries to reattach to old sessions; sessionKey produced by a different naming convention than the one used when replies were captured; querying before the first user message round-trip completed.

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/be43a594e7017007. Report an issue: GitHub.