{"record":{"id":"1ffb4e3e14108265","repo":"astral-sh/ruff","slug":"invalidparams","errorCode":"InvalidParams","errorMessage":"Invalid command `{name}`","messagePattern":"Invalid command `(.+?)`","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/ruff_server/src/server.rs","lineNumber":368,"sourceCode":"        [\n            SupportedCommand::Format,\n            SupportedCommand::FixAll,\n            SupportedCommand::OrganizeImports,\n            SupportedCommand::Debug,\n        ]\n    }\n}\n\nimpl FromStr for SupportedCommand {\n    type Err = anyhow::Error;\n\n    fn from_str(name: &str) -> anyhow::Result<Self, Self::Err> {\n        Ok(match name {\n            \"ruff.applyAutofix\" => Self::FixAll,\n            \"ruff.applyFormat\" => Self::Format,\n            \"ruff.applyOrganizeImports\" => Self::OrganizeImports,\n            \"ruff.printDebugInformation\" => Self::Debug,\n            _ => return Err(anyhow::anyhow!(\"Invalid command `{name}`\")),\n        })\n    }\n}\n\ntype PanicHook = Box<dyn Fn(&PanicHookInfo<'_>) + 'static + Sync + Send>;\n\nstruct ServerPanicHookHandler {\n    hook: Option<PanicHook>,\n    // Hold on to the strong reference for as long as the panic hook is set.\n    _client: Arc<Client>,\n}\n\nimpl ServerPanicHookHandler {\n    fn new(client: Client) -> Self {\n        let hook = std::panic::take_hook();\n        let client = Arc::new(client);\n\n        // Use a weak reference to the client because it must be dropped when exiting or the","sourceCodeStart":350,"sourceCodeEnd":386,"githubUrl":"https://github.com/astral-sh/ruff/blob/d1087a4b9e03d253a88703f34e0869ee4b805456/crates/ruff_server/src/server.rs#L350-L386","documentation":"The Ruff language server accepts exactly four workspace/executeCommand command IDs: ruff.applyAutofix, ruff.applyFormat, ruff.applyOrganizeImports, and ruff.printDebugInformation. The command string from the request is parsed via FromStr; anything else fails to parse and the request is rejected with an InvalidParams error.","triggerScenarios":"Typos like `ruff.applyFix` or `ruff.autofix`; invoking commands from a newer/older extension than the running server; clients guessing command names instead of using the ones the extension advertises; wrappers forwarding commands meant for another server.","commonSituations":"Custom editor integrations hardcoding command IDs across Ruff versions; mismatched extension/server versions after an upgrade; copy-pasted sample code using renamed commands.","solutions":["Use one of the exact IDs: ruff.applyAutofix, ruff.applyFormat, ruff.applyOrganizeImports, ruff.printDebugInformation","Update the Ruff extension and server together so command names match the running version","Check the server's tracing log to see the raw command string it received","Prefer LSP native requests (textDocument/formatting, codeAction source.fixAll) over executeCommand where available"],"exampleFix":"// before\nawait connection.sendRequest('workspace/executeCommand', { command: 'ruff.applyFix', arguments: [{ uri: docUri }] });\n// Error: Invalid command `ruff.applyFix`\n\n// after\nawait connection.sendRequest('workspace/executeCommand', { command: 'ruff.applyAutofix', arguments: [{ uri: docUri }] });","handlingStrategy":"validation","validationCode":"// Whitelist the commands this server version supports before invoking\nconst SUPPORTED = new Set([\n  'ruff.applyAutofix',\n  'ruff.applyFormat',\n  'ruff.applyOrganizeImports',\n  'ruff.printDebugInformation',\n]);\nif (!SUPPORTED.has(command)) throw new Error(`unsupported command: ${command}`);\nawait conn.sendRequest('workspace/executeCommand', { command, arguments });","typeGuard":"function isSupportedRuffCommand(cmd: string): cmd is\n  | 'ruff.applyAutofix' | 'ruff.applyFormat'\n  | 'ruff.applyOrganizeImports' | 'ruff.printDebugInformation' {\n  return cmd === 'ruff.applyAutofix' || cmd === 'ruff.applyFormat'\n    || cmd === 'ruff.applyOrganizeImports' || cmd === 'ruff.printDebugInformation';\n}","tryCatchPattern":null,"preventionTips":["Source the command list from the extension/server version in use rather than hardcoding","Update extension and server together so command IDs stay in sync","Prefer native LSP requests (formatting, codeAction) over executeCommand where possible"],"tags":["lsp","execute-command","ruff-server","invalid-params"],"backgroundTag":"unsupported-lsp-command","analyzedSha":"d1087a4b9e03d253a88703f34e0869ee4b805456","analyzedAt":"2026-08-20T16:33:49.445Z","contentChangedAt":"2026-08-20T16:33:49.445Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}