{"record":{"id":"a264534df1052227","repo":"XTLS/Xray-core","slug":"failed-to-process-data","errorCode":null,"errorMessage":"failed to process data","messagePattern":"failed to process data","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/mux/server.go","lineNumber":358,"sourceCode":"\t\treturn errors.New(\"failed to read metadata\").Base(err)\n\t}\n\n\tswitch meta.SessionStatus {\n\tcase SessionStatusKeepAlive:\n\t\terr = w.handleStatusKeepAlive(&meta, reader)\n\tcase SessionStatusEnd:\n\t\terr = w.handleStatusEnd(&meta, reader)\n\tcase SessionStatusNew:\n\t\terr = w.handleStatusNew(session.ContextWithIsReverseMux(ctx, false), &meta, reader)\n\tcase SessionStatusKeep:\n\t\terr = w.handleStatusKeep(&meta, reader)\n\tdefault:\n\t\tstatus := meta.SessionStatus\n\t\treturn errors.New(\"unknown status: \", status).AtError()\n\t}\n\n\tif err != nil {\n\t\treturn errors.New(\"failed to process data\").Base(err)\n\t}\n\treturn nil\n}\n\nfunc (w *ServerWorker) run(ctx context.Context) {\n\tdefer func() {\n\t\tcommon.Must(w.done.Close())\n\t}()\n\n\treader := &buf.BufferedReader{Reader: w.link.Reader}\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tdefault:\n\t\t\terr := w.handleFrame(ctx, reader)\n\t\t\tif err != nil {","sourceCodeStart":340,"sourceCodeEnd":376,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/common/mux/server.go#L340-L376","documentation":"A status handler (handleStatusKeepAlive/End/New/Keep) returned an error, and handleFrame wraps it as 'failed to process data'. This is a pass-through wrapper: the Base() error (dispatch failure, session-add failure, unexpected network, packet read error, etc.) carries the real cause, and the error ends the mux connection's run loop.","triggerScenarios":"Any of the per-status handlers failing: dispatch rejection (171/169), session add collision (172/170), network restriction (167), or data-frame read errors.","commonSituations":"Developers see only this message in logs and chase the wrapper; the actionable detail is always in the chained base error logged alongside it.","solutions":["Always read the full error chain (LogError prints Base()) and fix the underlying handler error (see errors 167-172, 166).","Enable access/routing logs at debug level to capture which substream/status triggered the failure.","Once the base cause is fixed, this error disappears; the wrapper itself needs no separate remedy.","If the base error is a transient upstream failure, note that mux shares fate: one bad substream request can drop the whole connection, so validate destinations before muxing them."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := w.handleFrame(ctx, reader); err != nil {\n    // 'failed to process data' is a wrapper; always inspect the base error\n    cause := err\n    for errors.Unwrap(cause) != nil { cause = errors.Unwrap(cause) }\n    log.Warn(\"mux handler failed, root cause: \", cause)\n    return err // run loop exits, mux connection closes\n}","preventionTips":["Never debug from the wrapper string alone — log the full chain.","Fix the underlying handler error (dispatch, session add, network restriction) rather than this wrapper.","Isolate risky destinations outside mux to limit blast radius."],"tags":["mux","error-handling","wrapper","xray"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}