{"record":{"id":"c7ea0531f9592593","repo":"PRQL/prql","slug":"lsp-requires-prqlc-to-be-built-with-the-lsp","errorCode":null,"errorMessage":"`lsp` requires `prqlc` to be built with the `lsp` feature","messagePattern":"`lsp` requires `prqlc` to be built with the `lsp` feature","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"prqlc/prqlc/src/cli/mod.rs","lineNumber":357,"sourceCode":"            Command::Debug(DebugCommand::JsonSchema { ir_type }) => {\n                let schema = match ir_type {\n                    IntermediateRepr::Pl => schema_for!(pl::ModuleDef),\n                    IntermediateRepr::Rq => schema_for!(rq::RelationalQuery),\n                    IntermediateRepr::Lineage => schema_for!(FrameCollector),\n                };\n                io::stdout().write_all(&serde_json::to_string_pretty(&schema)?.into_bytes())?;\n                Ok(())\n            }\n            #[cfg(feature = \"lsp\")]\n            Command::Lsp => match lsp::run() {\n                Ok(_) => Ok(()),\n                Err(err) => Err(anyhow!(err)),\n            },\n            // Without the feature there's no server to start. This has to be\n            // handled here rather than falling through to `run_io_command`,\n            // which has no `IoArgs` to work with and would panic.\n            #[cfg(not(feature = \"lsp\"))]\n            Command::Lsp => Err(anyhow!(\n                \"`lsp` requires `prqlc` to be built with the `lsp` feature\"\n            )),\n            _ => self.run_io_command(),\n        }\n    }\n\n    fn list_targets(&self) -> std::result::Result<(), anyhow::Error> {\n        println!(\"{}\", Target::names().join(\"\\n\"));\n        Ok(())\n    }\n\n    fn run_io_command(&mut self) -> std::result::Result<(), anyhow::Error> {\n        let (mut file_tree, main_path) = self.read_input()?;\n\n        self.execute(&mut file_tree, &main_path)\n            .and_then(|buf| self.write_output(&buf))\n    }\n","sourceCodeStart":339,"sourceCodeEnd":375,"githubUrl":"https://github.com/PRQL/prql/blob/e164e249b99485890036eb60f57c37520379b240/prqlc/prqlc/src/cli/mod.rs#L339-L375","documentation":"prqlc's `lsp` subcommand starts the LSP server, but the server implementation is only compiled when the `lsp` cargo feature is enabled. The CLI is deliberately built without that feature by default (it pulls in heavy tower-lsp dependencies), so invoking `lsp` on such a build returns this error instead of panicking.","triggerScenarios":"Running `prqlc lsp` against a binary compiled without `--features lsp` (e.g. the default `cargo install prqlc`, distro packages, or `cargo build` without feature flags).","commonSituations":"Editor plugin expects `prqlc lsp` but the installed binary came from a default-features release; CI built the binary without features; an older or minimal package build where lsp was stripped to reduce binary size.","solutions":["Rebuild/install with the feature enabled: `cargo install prqlc --features lsp`","If building from source: `cargo build -p prqlc --features lsp` and point the editor at the new binary","Use a published build known to include lsp support, or remove the `lsp` command from editor config if the feature is not needed"],"exampleFix":"// before\ncargo install prqlc\n// after\ncargo install prqlc --features lsp","handlingStrategy":"fallback","validationCode":"const hasLsp = (help: string) => /\\blsp\\b/.test(help);","typeGuard":"function supportsLsp(binary: string): boolean { return runCmd(binary, ['--help']).stdout.includes('lsp'); }","tryCatchPattern":"try { await startLsp(); } catch (e) { if (String(e).includes('lsp` requires')) { console.error('Install with: cargo install prqlc --features lsp'); } else { throw e; } }","preventionTips":["Pin the install command with --features lsp in docs/scripts","Probe `prqlc --help` for the lsp subcommand before wiring editors","Document the feature requirement in editor plugin READMEs"],"tags":["cli","feature-flags","lsp","build-configuration"],"backgroundTag":"feature-not-enabled","analyzedSha":"e164e249b99485890036eb60f57c37520379b240","analyzedAt":"2026-09-09T12:18:38.727Z","contentChangedAt":"2026-09-09T12:18:38.727Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}