nikivdev/code · error

empty response from seqd

Error message

empty response from seqd

What it means

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).

Source

Thrown at src/seq_client.rs:97

        let mut encoded = serde_json::to_vec(req).context("failed to encode seqd rpc request")?;
        encoded.push(b'\n');
        let stream = self.reader.get_mut();
        stream
            .write_all(&encoded)
            .context("failed to write seqd rpc request")?;
        stream.flush().context("failed to flush seqd rpc request")?;

        self.read_buf.clear();
        self.reader
            .read_until(b'\n', &mut self.read_buf)
            .context("failed to read seqd rpc response")?;

        if self.read_buf.last() == Some(&b'\n') {
            self.read_buf.pop();
        }

        if self.read_buf.is_empty() {
            bail!("empty response from seqd");
        }
        if self.read_buf.len() > 1_000_000 {
            bail!("seqd rpc response exceeded 1MB line limit");
        }

        let resp: RpcResponse = crate::json_parse::parse_json_bytes_in_place(&mut self.read_buf)
            .context("failed to decode seqd rpc response json")?;
        Ok(resp)
    }
}

#[cfg(not(unix))]
pub struct SeqClient;

#[cfg(not(unix))]
impl SeqClient {
    pub fn connect_with_timeout(
        _socket_path: impl AsRef<Path>,

View on GitHub (pinned to a747e741ae)

Solutions

  1. Verify the seqd daemon is running and healthy, then retry the request
  2. Reconnect the client (the stream may be half-closed) and resend
  3. Check seqd logs for a panic or shutdown at the time of the request
  4. Upgrade client/server if versions mismatch on the line protocol

Example fix

// before: single attempt
let resp = client.call(req)?;
// after: reconnect-and-retry on empty response
let resp = match client.call(req) {
    Err(e) if e.to_string().contains("empty response") => { client.reconnect()?; client.call(req)? }
    r => r?,
};
Defensive patterns

Strategy: retry

Validate before calling

// pre-flight: ensure seqd is reachable
let ready = std::net::TcpStream::connect((host, port)).is_ok();
if !ready { eprintln!("seqd not listening"); return; }

Try / catch

match client.call(req) {
    Err(e) if e.to_string() == "empty response from seqd" => {
        client.reconnect()?;
        client.call(req)  // single retry after reconnect
    }
    other => other,
}

Prevention

When it happens

Trigger: seqd closes the connection or sends a zero-length line before any RPC payload; a crash/restart of the seqd daemon mid-request.

Common situations: seqd not fully started; seqd crashed under load; proxy or socket layer dropping empty keep-alive frames; hitting the server before it listens.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/453faf83de859770. Report an issue: GitHub.