{"record":{"id":"453faf83de859770","repo":"nikivdev/code","slug":"empty-response-from-seqd","errorCode":null,"errorMessage":"empty response from seqd","messagePattern":"empty response from seqd","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/seq_client.rs","lineNumber":97,"sourceCode":"        let mut encoded = serde_json::to_vec(req).context(\"failed to encode seqd rpc request\")?;\n        encoded.push(b'\\n');\n        let stream = self.reader.get_mut();\n        stream\n            .write_all(&encoded)\n            .context(\"failed to write seqd rpc request\")?;\n        stream.flush().context(\"failed to flush seqd rpc request\")?;\n\n        self.read_buf.clear();\n        self.reader\n            .read_until(b'\\n', &mut self.read_buf)\n            .context(\"failed to read seqd rpc response\")?;\n\n        if self.read_buf.last() == Some(&b'\\n') {\n            self.read_buf.pop();\n        }\n\n        if self.read_buf.is_empty() {\n            bail!(\"empty response from seqd\");\n        }\n        if self.read_buf.len() > 1_000_000 {\n            bail!(\"seqd rpc response exceeded 1MB line limit\");\n        }\n\n        let resp: RpcResponse = crate::json_parse::parse_json_bytes_in_place(&mut self.read_buf)\n            .context(\"failed to decode seqd rpc response json\")?;\n        Ok(resp)\n    }\n}\n\n#[cfg(not(unix))]\npub struct SeqClient;\n\n#[cfg(not(unix))]\nimpl SeqClient {\n    pub fn connect_with_timeout(\n        _socket_path: impl AsRef<Path>,","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/seq_client.rs#L79-L115","documentation":"The seq client's call method reads a single line response from seqd and strips the trailing newline. An empty buffer means seqd returned nothing, which is treated as a protocol failure rather than parsed as RPC (src/seq_client.rs:97).","triggerScenarios":"seqd closes the connection or sends a zero-length line before any RPC payload; a crash/restart of the seqd daemon mid-request.","commonSituations":"seqd not fully started; seqd crashed under load; proxy or socket layer dropping empty keep-alive frames; hitting the server before it listens.","solutions":["Verify the seqd daemon is running and healthy, then retry the request","Reconnect the client (the stream may be half-closed) and resend","Check seqd logs for a panic or shutdown at the time of the request","Upgrade client/server if versions mismatch on the line protocol"],"exampleFix":"// before: single attempt\nlet resp = client.call(req)?;\n// after: reconnect-and-retry on empty response\nlet resp = match client.call(req) {\n    Err(e) if e.to_string().contains(\"empty response\") => { client.reconnect()?; client.call(req)? }\n    r => r?,\n};","handlingStrategy":"retry","validationCode":"// pre-flight: ensure seqd is reachable\nlet ready = std::net::TcpStream::connect((host, port)).is_ok();\nif !ready { eprintln!(\"seqd not listening\"); return; }","typeGuard":null,"tryCatchPattern":"match client.call(req) {\n    Err(e) if e.to_string() == \"empty response from seqd\" => {\n        client.reconnect()?;\n        client.call(req)  // single retry after reconnect\n    }\n    other => other,\n}","preventionTips":["Add a readiness check against seqd before issuing RPCs","Monitor seqd health/restarts and correlate with client errors","Cap responses server-side under the 1MB line limit to avoid truncation drops"],"tags":["rpc","network","protocol"],"backgroundTag":"empty-server-response","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}