{"record":{"id":"a824f51cd00ad734","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/ty_server/src/capabilities.rs","lineNumber":79,"sourceCode":"    const fn identifier(self) -> &'static str {\n        match self {\n            SupportedCommand::Debug => \"ty.printDebugInformation\",\n        }\n    }\n\n    /// Returns all the commands that the server currently supports.\n    const fn all() -> [SupportedCommand; 1] {\n        [SupportedCommand::Debug]\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            \"ty.printDebugInformation\" => Self::Debug,\n            _ => return Err(anyhow::anyhow!(\"Invalid command `{name}`\")),\n        })\n    }\n}\n\n/// Returns the preferred markup kind, derived from preference list.\nfn preferred_markup_kind(formats: &[MarkupKind]) -> Option<&MarkupKind> {\n    formats\n        .iter()\n        .find(|markup_kind| matches!(markup_kind, MarkupKind::Markdown | MarkupKind::PlainText))\n}\n\nimpl ResolvedClientCapabilities {\n    /// Returns `true` if the client supports workspace diagnostic refresh.\n    pub(crate) const fn supports_workspace_diagnostic_refresh(self) -> bool {\n        self.contains(Self::WORKSPACE_DIAGNOSTIC_REFRESH)\n    }\n\n    /// Returns `true` if the client supports workspace configuration.","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/astral-sh/ruff/blob/672bb4edf04c84f8b0753346359daee4057158f2/crates/ty_server/src/capabilities.rs#L61-L97","documentation":"The LSP server received a workspace/executeCommand request whose `command` string does not match any SupportedCommand. FromStr for SupportedCommand (capabilities.rs) only accepts \"ty.printDebugInformation\"; anything else is rejected with error code InvalidParams.","triggerScenarios":"Sending workspace/executeCommand with a command name other than \"ty.printDebugInformation\" — e.g. a command from a different tool, a renamed command, or a client extension invoking a command this server version does not register.","commonSituations":"Editor extension and ty server version mismatch (command renamed/added later), commands left over from a fork or older protocol, or a hand-rolled LSP client hardcoding the wrong string.","solutions":["Use the exact string \"ty.printDebugInformation\"","Check the `commands` list advertised in the server's initialize result before invoking","Update the ty server and the client extension to matching versions","Remove the stale keybinding/extension that sends the unknown command"],"exampleFix":"// before\nclient.sendRequest('workspace/executeCommand', { command: 'ty.debugInfo' });\n\n// after\nclient.sendRequest('workspace/executeCommand', { command: 'ty.printDebugInformation' });","handlingStrategy":"validation","validationCode":"// TS: check against the server's advertised commands before invoking\nconst serverCommands: string[] = initResult.capabilities.executeCommandProvider?.commands ?? [];\nif (serverCommands.includes(name)) {\n  await client.sendRequest('workspace/executeCommand', { command: name });\n} else {\n  log.warn(`command ${name} not supported by ty server`);\n}","typeGuard":"const isSupportedCommand = (name: string): boolean =>\n  name === 'ty.printDebugInformation';","tryCatchPattern":null,"preventionTips":["Read the `commands` array from the initialize result, not from docs or memory","Pin client extension and ty server versions together","Don't invent command names; the server rejects everything except its exact literal"],"tags":["lsp","execute-command","invalid-params","commands"],"backgroundTag":null,"analyzedSha":"672bb4edf04c84f8b0753346359daee4057158f2","analyzedAt":"2026-08-16T08:54:05.464Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}