{"record":{"id":"29e2422c629216c7","repo":"diem/diem","slug":"transport-error-0","errorCode":null,"errorMessage":"Transport error: {0}","messagePattern":"Transport error: (.+?)","errorType":"error_code","errorClass":"StreamError","httpStatus":null,"severity":"error","filePath":"json-rpc/src/stream_rpc/errors.rs","lineNumber":14,"sourceCode":"// Copyright (c) The Diem Core Contributors\n// SPDX-License-Identifier: Apache-2.0\n\nuse thiserror::Error;\n\n#[derive(Debug, Error)]\npub enum StreamError {\n    #[error(\"Could not convert {0} to string\")]\n    CouldNotStringifyMessage(String),\n    #[error(\"Client#{0} is closed\")]\n    ClientAlreadyClosed(u64),\n    #[error(\"Received disconnect request message from client\")]\n    ClientWantsToDisconnect,\n    #[error(\"Transport error: {0}\")]\n    TransportError(String),\n}\n","sourceCodeStart":1,"sourceCodeEnd":17,"githubUrl":"https://github.com/diem/diem/blob/fc4714a8ea273b6efe8b13dbce72ea60aad9a16c/json-rpc/src/stream_rpc/errors.rs#L1-L17","documentation":"`StreamError::TransportError(String)` reports a failure in the underlying transport carrying the streaming RPC (e.g., the WebSocket/network layer), with details in the carried string. It means message delivery failed for reasons outside stream logic itself — connection resets, protocol errors, I/O failures.","triggerScenarios":"The socket/transport write or read fails while streaming messages: peer reset the connection, network interruption, TLS handshake failure, or the transport layer returned a protocol-level error.","commonSituations":"Unstable client networks dropping WebSockets mid-stream; load balancers with short idle timeouts killing long-lived streams; server restarts severing all client transports.","solutions":["Read the carried string to identify the transport-layer cause, then address that specific issue.","Implement client-side reconnection with resubscribe/backoff for streams.","Configure idle keep-alives/timeouts on proxies/load balancers to keep long streams alive.","Verify network/TLS configuration between client and node; test connectivity to the RPC port."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Pre-flight connectivity check to the RPC endpoint before opening streams\nlet addr = format!(\"{}:{}\", host, port);\nstd::net::TcpStream::connect(&addr).expect(\"RPC endpoint unreachable before streaming\");","typeGuard":null,"tryCatchPattern":"match open_stream(&endpoint) {\n    Err(StreamError::TransportError(msg)) => {\n        warn!(\"transport failure: {} — retrying with backoff\", msg);\n        backoff_retry(|| open_stream(&endpoint), 5);\n    }\n    Err(e) => handle_other(e),\n    Ok(stream) => pump(stream),\n}","preventionTips":["Add automatic reconnect-with-backoff and resubscribe logic on stream clients.","Configure keep-alive pings and generous idle timeouts on proxies/load balancers.","Monitor network stability and TLS certificate validity for RPC endpoints."],"tags":["rust","json-rpc","streaming","network","websocket"],"backgroundTag":"stream-transport-error","analyzedSha":"fc4714a8ea273b6efe8b13dbce72ea60aad9a16c","analyzedAt":"2026-09-04T21:07:05.890Z","contentChangedAt":"2026-09-04T21:07:05.890Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}