rust-lang/rust-analyzer · error · ServerError

proc-macro server did not respond with data

Error message

proc-macro server did not respond with data

What it means

A `ServerError` constructed in `send_task_legacy` when the legacy JSON protocol request succeeded at the transport level but the send closure returned `Ok(None)` — i.e. the proc-macro server acknowledged the request without ever delivering a response payload. It indicates the external proc-macro server process died, hung, or violated the legacy protocol; the input at fault is the request that went unanswered.

Source

Thrown at crates/proc-macro-api/src/process.rs:332

        result
    }

    pub(crate) fn send_task_legacy<Request, Response>(
        &self,
        send: impl FnOnce(
            &mut dyn Write,
            &mut dyn BufRead,
            Request,
            &mut String,
        ) -> Result<Option<Response>, ServerError>,
        req: Request,
    ) -> Result<Response, ServerError> {
        self.with_locked_io(String::new(), |writer, reader, buf| {
            send(writer, reader, req, buf).and_then(|res| {
                res.ok_or_else(|| {
                    let message = "proc-macro server did not respond with data".to_owned();
                    ServerError {
                        io: Some(Arc::new(io::Error::new(
                            io::ErrorKind::BrokenPipe,
                            message.clone(),
                        ))),
                        message,
                    }
                })
            })
        })
    }

    fn with_locked_io<R, B>(
        &self,
        mut buf: B,
        f: impl FnOnce(&mut dyn Write, &mut dyn BufRead, &mut B) -> Result<R, ServerError>,
    ) -> Result<R, ServerError> {
        let state = &mut *self.state.lock().unwrap();
        f(&mut state.stdin, &mut state.stdout, &mut buf).map_err(|e| {
            if e.io.as_ref().map(|it| it.kind()) == Some(io::ErrorKind::BrokenPipe) {

View on GitHub (pinned to e8f7e90aa3)

Solutions

  1. Restart the proc-macro server process; it likely crashed or deadlocked (check its stderr output in the log)
  2. Verify the proc-macro server binary version matches the protocol rust-analyzer negotiated
  3. Check that the request being sent is actually supported by the legacy protocol version spoken by the server
  4. Inspect stderr_errors captured alongside the empty response for the underlying process failure
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at crates/proc-macro-api/src/process.rs:332 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of rust-lang/rust-analyzer@e8f7e90aa3 (2026-09-03). Data as JSON: /api/errors/26df46d9adeaa21b. Report an issue: GitHub.