PRQL/prql · error

{err}

Error message

{err}

What it means

When the `lsp` feature is compiled in, `prqlc lsp` starts the language server; any error from lsp::run() is wrapped with anyhow! and returned as the command's error, so the message body is the underlying LSP error text. Without the feature there is a separate static message, so this variant only appears in LSP-enabled builds.

Solutions

  1. Read the wrapped inner error text and address the underlying cause (binding, transport, missing tool)
  2. Verify your editor client sends a correct LSP initialize request before other messages
  3. Update prqlc to the latest version — LSP bugs are frequently fixed upstream
  4. Run the server manually with RUST_LOG=debug to capture detailed logs

Example fix

// before (swallowing context)
Err(err) => Err(anyhow!(err)),
// after (caller-side: capture logs to diagnose)
RUST_LOG=debug prqlc lsp 2>lsp.log
Defensive patterns

Strategy: try-catch

Validate before calling

# Confirm lsp feature and check server starts
prqlc --version && timeout 2 sh -c 'prqlc lsp < /dev/null'; echo "exit=$?"

Try / catch

// Editor client side: handle server exit and log stderr
server.on('exit', (code) => console.error(`prqlc lsp exited: ${code}`));
try { await client.start(); } catch (e) { console.error('LSP start failed', e); }

Prevention

When it happens

Trigger: Running `prqlc lsp` in a build with the lsp feature enabled while the server fails to start or dies — port/binding issues, transport (stdio) broken pipe, initialization failure in the LSP loop.

Common situations: Editor clients (VS Code, Neovim) launching prqlc lsp and the server erroring during handshake or when the client closes the pipe; running the binary manually to debug an editor setup.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of PRQL/prql@e164e249b9 (2026-09-09). Data as JSON: /api/errors/ee80116268aa6e46. Report an issue: GitHub.

Appendix: source

Thrown at prqlc/prqlc/src/cli/mod.rs:351

                Ok(())
            }
            Command::Debug(DebugCommand::Ast) => {
                prqlc::ir::pl::print_mem_sizes();
                Ok(())
            }
            Command::Debug(DebugCommand::JsonSchema { ir_type }) => {
                let schema = match ir_type {
                    IntermediateRepr::Pl => schema_for!(pl::ModuleDef),
                    IntermediateRepr::Rq => schema_for!(rq::RelationalQuery),
                    IntermediateRepr::Lineage => schema_for!(FrameCollector),
                };
                io::stdout().write_all(&serde_json::to_string_pretty(&schema)?.into_bytes())?;
                Ok(())
            }
            #[cfg(feature = "lsp")]
            Command::Lsp => match lsp::run() {
                Ok(_) => Ok(()),
                Err(err) => Err(anyhow!(err)),
            },
            // Without the feature there's no server to start. This has to be
            // handled here rather than falling through to `run_io_command`,
            // which has no `IoArgs` to work with and would panic.
            #[cfg(not(feature = "lsp"))]
            Command::Lsp => Err(anyhow!(
                "`lsp` requires `prqlc` to be built with the `lsp` feature"
            )),
            _ => self.run_io_command(),
        }
    }

    fn list_targets(&self) -> std::result::Result<(), anyhow::Error> {
        println!("{}", Target::names().join("\n"));
        Ok(())
    }

    fn run_io_command(&mut self) -> std::result::Result<(), anyhow::Error> {

View on GitHub (pinned to e164e249b9)