{"record":{"id":"713f9720f37ecd87","repo":"sxyazi/yazi","slug":"connection-closed-before-receiving-reply","errorCode":null,"errorMessage":"Connection closed before receiving reply","messagePattern":"Connection closed before receiving reply","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"yazi-cli/src/dds/exec.rs","lineNumber":69,"sourceCode":"\t\tdrop(writer);\n\n\t\twhile let Ok(Some(line)) = lines.next_line().await {\n\t\t\tmatch line.split(',').next() {\n\t\t\t\tSome(\"hey\") => {\n\t\t\t\t\tif let Ok(Ember::Hey(hey)) = Payload::from_str(&line).map(|p| p.body) {\n\t\t\t\t\t\tSelf::ensure_version(Some(&hey.version))?;\n\t\t\t\t\t\tSelf::ensure_ability(&hey.peers, kind, receiver)?;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tSome(kind) if kind == reply_kind => match Payload::from_str(&line)?.body {\n\t\t\t\t\tEmber::Custom(body) => return Ok(body.data),\n\t\t\t\t\t_ => bail!(\"Expected custom payload of kind `{reply_kind}`\"),\n\t\t\t\t},\n\t\t\t\t_ => {}\n\t\t\t}\n\t\t}\n\n\t\tbail!(\"Connection closed before receiving reply\")\n\t}\n}\n","sourceCodeStart":51,"sourceCodeEnd":72,"githubUrl":"https://github.com/sxyazi/yazi/blob/5f901b886b14de1f17460b6e52e9de5d67f8aba9/yazi-cli/src/dds/exec.rs#L51-L72","documentation":"`Dds::ask` loops reading reply lines and returns on the first matching custom reply; if the stream ends (EOF) before any matching reply arrives, it bails with `Connection closed before receiving reply`. This means the peer disconnected or never answered within the connection's lifetime.","triggerScenarios":"Yazi exits or crashes while `ya` waits for the reply; the connection drops (network/IPC socket closed); the peer never emits the expected `reply_kind` line before closing.","commonSituations":"Target Yazi instance killed mid-request; long-running requests outliving a Yazi restart; `ya pub` sent to a receiver that shuts down before replying.","solutions":["Verify Yazi is still running (`pgrep yazi`) and retry the command.","Check Yazi logs (`YAZI_LOG=debug`) for a crash or handler panic around the request time.","Confirm `YAZI_PID` points to a live instance, then re-run the `ya` command."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if !yazi_running() { return Err(\"yazi is not running; start it before sending messages\"); }","typeGuard":null,"tryCatchPattern":"match Dds::ask(...).await {\n  Err(e) if e.to_string() == \"Connection closed before receiving reply\" => {\n    if yazi_running() { retry_with_backoff(2) } else { eprintln!(\"yazi exited mid-request\") }\n  }\n  other => other,\n}","preventionTips":["Confirm the target yazi process is alive before long-running requests.","Avoid restarting or killing yazi while `ya` requests are in flight.","Check yazi logs for panics/crashes if disconnects recur."],"tags":["ipc","dds","connection","timeout"],"backgroundTag":"connection-closed-before-response","analyzedSha":"5f901b886b14de1f17460b6e52e9de5d67f8aba9","analyzedAt":"2026-09-02T18:38:25.566Z","contentChangedAt":"2026-09-02T18:38:25.566Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}