{"record":{"id":"f9754b62b70c7193","repo":"XTLS/Xray-core","slug":"fallback-ends","errorCode":null,"errorMessage":"fallback ends","messagePattern":"fallback ends","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"proxy/trojan/server.go","lineNumber":545,"sourceCode":"\t\t\treturn errors.New(\"failed to fallback request payload\").Base(err).AtInfo()\n\t\t}\n\t\treturn nil\n\t}\n\n\twriter := buf.NewWriter(connection)\n\n\tgetResponse := func() error {\n\t\tdefer timer.SetTimeout(sessionPolicy.Timeouts.UplinkOnly)\n\t\tif err := buf.Copy(serverReader, writer, buf.UpdateActivity(timer)); err != nil {\n\t\t\treturn errors.New(\"failed to deliver response payload\").Base(err).AtInfo()\n\t\t}\n\t\treturn nil\n\t}\n\n\tif err := task.Run(ctx, task.OnSuccess(postRequest, task.Close(serverWriter)), task.OnSuccess(getResponse, task.Close(writer))); err != nil {\n\t\tcommon.Must(common.Interrupt(serverReader))\n\t\tcommon.Must(common.Interrupt(serverWriter))\n\t\treturn errors.New(\"fallback ends\").Base(err).AtInfo()\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":527,"sourceCodeEnd":550,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/proxy/trojan/server.go#L527-L550","documentation":"Aggregate wrapper returned when either fallback pipe ([732] or [733]) failed inside task.Run; both fallback-direction readers/writers are interrupted for cleanup. It marks fallback termination, logged AtInfo.","triggerScenarios":"Any request-payload or response-payload failure during the fallback relay, or context cancellation from the idle timer after the client went silent.","commonSituations":"Routine fallback teardown after probers disconnect; transient backend failures.","solutions":["Inspect the Base chain to find which direction failed","Address the underlying failure per [732]/[733] if fallback service quality matters","Otherwise treat as log noise and lower loglevel if too chatty"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := task.Run(ctx, task.OnSuccess(postRequest, task.Close(serverWriter)), task.OnSuccess(getResponse, task.Close(writer))); err != nil {\n    common.Must(common.Interrupt(serverReader))\n    common.Must(common.Interrupt(serverWriter))\n    return errors.New(\"fallback ends\").Base(err).AtInfo()\n}","preventionTips":["Unwrap the Base error to attribute the failure to [732] vs [733]","Expect these during xray reload while fallback sessions are active","Keep fallback loglevel at info or lower in production"],"tags":["trojan","fallback","lifecycle"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}