{"record":{"id":"ce2d5b98551ab0d9","repo":"chenhg5/cc-connect","slug":"cloud-web-reconstruct-reply-not-supported-by-gate","errorCode":null,"errorMessage":"cloud_web: reconstruct_reply not supported by gateway","messagePattern":"cloud_web: reconstruct_reply not supported by gateway","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/cloud-web/cloudweb.go","lineNumber":670,"sourceCode":"\trc, err := parseReplyCtx(replyCtx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !p.hasCap(capAudio) {\n\t\treturn core.ErrNotSupported\n\t}\n\treturn p.sendWire(ctx, map[string]any{\n\t\t\"type\":        \"audio\",\n\t\t\"session_key\": rc.SessionKey,\n\t\t\"reply_ctx\":   rc.ReplyCtx,\n\t\t\"data\":        base64.StdEncoding.EncodeToString(audio),\n\t\t\"format\":      format,\n\t})\n}\n\nfunc (p *Platform) ReconstructReplyCtx(sessionKey string) (any, error) {\n\tif !p.hasCap(capReconstructReply) {\n\t\treturn nil, fmt.Errorf(\"cloud_web: reconstruct_reply not supported by gateway\")\n\t}\n\treplyCtx, ok := p.lookupReplyCtx(sessionKey)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"cloud_web: no stored reply context for session %q\", sessionKey)\n\t}\n\treturn replyContext{SessionKey: sessionKey, ReplyCtx: replyCtx}, nil\n}\n\nfunc (p *Platform) sendWire(ctx context.Context, msg map[string]any) error {\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\treturn p.tp.Send(ctx, msg)\n}\n\nfunc parseReplyCtx(v any) (replyContext, error) {\n\tswitch rc := v.(type) {\n\tcase replyContext:","sourceCodeStart":652,"sourceCodeEnd":688,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/cloud-web/cloudweb.go#L652-L688","documentation":"ReconstructReplyCtx can only rebuild a reply context from data the platform retained. The gateway transport does not register the capReconstructReply capability, so any call immediately returns this error rather than attempting reconstruction. Callers should check the capability first.","triggerScenarios":"Calling p.ReconstructReplyCtx(sessionKey) on a cloud_web Platform instance created with the gateway transport (capability not registered).","commonSituations":"Engine session-restore logic calling ReconstructReplyCtx uniformly across platforms, hitting the gateway-backed instance; switching a deployment from long_poll/websocket to gateway while existing restore code assumes reconstruction works; writing tests against one transport and running under another.","solutions":["Check the reconstruct-reply capability before calling and skip restoration for gateway-backed sessions","Start a fresh message (Send) for gateway sessions instead of reconstructing old reply contexts","Switch the platform to a transport that supports reconstruct_reply if reply-context restoration is required","Wrap the call so the error is treated as 'not available' rather than a hard failure in the restore path"],"exampleFix":"// before\nctxAny, err := p.ReconstructReplyCtx(sessionKey)\nif err != nil { return err }\n\n// after\nif !p.SupportsReconstructReply() {\n    return nil // gateway: start fresh session instead\n}\nctxAny, err := p.ReconstructReplyCtx(sessionKey)","handlingStrategy":"validation","validationCode":"if !p.SupportsReconstructReply() {\n    return nil // skip restore for gateway transport\n}","typeGuard":"rr, ok := p.(ReconstructReplyer); if !ok { /* capability absent */ }","tryCatchPattern":"rc, err := p.ReconstructReplyCtx(key)\nif err != nil && strings.Contains(err.Error(), \"not supported\") {\n    return nil // gateway: start fresh\n}","preventionTips":["Query capability interfaces before calling optional platform methods","Make session-restore tolerant of platforms lacking reconstruction","Keep per-transport capability notes where deployment configs live"],"tags":["cloud-web","gateway","capability","reply-context"],"backgroundTag":"unsupported-operation","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}