{"record":{"id":"938065069e3111d4","repo":"astral-sh/ruff","slug":"python-extension-is-not-expected-to-be-combined","errorCode":null,"errorMessage":"`python_extension` is not expected to be combined with the initialization options as it's only set by the ty VS Code extension in the `workspace/configuration` request.","messagePattern":"`python_extension` is not expected to be combined with the initialization options as it's only set by the ty VS Code extension in the `workspace/configuration` request\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/ty_server/src/session/options.rs","lineNumber":526,"sourceCode":"\nimpl Experimental {\n    fn into_settings(self) -> ExperimentalSettings {\n        // `use_uv` is resolved separately before project discovery because changing it requires\n        // rebuilding every project database.\n        let Self { use_uv: _ } = self;\n        ExperimentalSettings {}\n    }\n}\n\n#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, Eq)]\n#[serde(rename_all = \"camelCase\")]\npub struct PythonExtension {\n    active_environment: Option<ActiveEnvironment>,\n}\n\nimpl Combine for PythonExtension {\n    fn combine_with(&mut self, _other: Self) {\n        panic!(\n            \"`python_extension` is not expected to be combined with the initialization options as \\\n            it's only set by the ty VS Code extension in the `workspace/configuration` request.\"\n        );\n    }\n}\n\n#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]\n#[serde(rename_all = \"camelCase\")]\npub(crate) struct ActiveEnvironment {\n    executable: PythonExecutable,\n    #[deprecated]\n    environment: Option<PythonEnvironment>,\n    version: Option<EnvironmentVersion>,\n}\n\n#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]\n#[serde(rename_all = \"camelCase\")]\npub(crate) struct EnvironmentVersion {","sourceCodeStart":508,"sourceCodeEnd":544,"githubUrl":"https://github.com/astral-sh/ruff/blob/26f38c119cac42e4d320ba08f09224fdec74af2c/crates/ty_server/src/session/options.rs#L508-L544","documentation":"The `python_extension` server option is special: it is never part of initialization options and is only populated from the `workspace/configuration` request issued by the ty VS Code extension. Its `Combine` implementation (used to merge layered configuration) therefore panics if it is ever asked to combine, because that would mean someone put `python_extension` in the wrong configuration layer.","triggerScenarios":"Sending a `python_extension` section inside `initializationOptions` when starting the ty LSP server, so the session tries to combine it with client/extension settings via `Combine::combine_with`.","commonSituations":"Users or client authors copying the extension's settings into initializationOptions in launch configurations (e.g. VS Code launch.json, Neovim LSP setup); misconfigured LSP client adapters passing all settings at init time.","solutions":["Remove the `python_extension` key from your LSP initializationOptions.","Let the ty VS Code extension supply those settings via the `workspace/configuration` request instead of passing them at initialization.","Put only supported workspace settings (e.g. python path, interpreter) in initializationOptions."],"exampleFix":"// before\ninitializationOptions = { python_extension: { activeEnvironment: \"venv\" } };\n// after\ninitializationOptions = {}; // extension settings come via workspace/configuration","handlingStrategy":"validation","validationCode":"// Client-side check before sending initializationOptions:\nconst forbidden = ['python_extension'];\nfor (const key of forbidden) {\n  if (key in initializationOptions) {\n    throw new Error(`${key} must come via workspace/configuration, not initializationOptions`);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never place python_extension in initializationOptions.","Let the ty VS Code extension own that settings section via workspace/configuration.","Review LSP client configs (launch.json, nvim lspconfig) for stray server-only keys."],"tags":["lsp","configuration","panic","vscode","server"],"backgroundTag":"invalid-initialization-options","analyzedSha":"26f38c119cac42e4d320ba08f09224fdec74af2c","analyzedAt":"2026-09-05T10:32:37.492Z","contentChangedAt":"2026-09-05T10:32:37.492Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}