Skip to content

Language Servers overwriting each other #12150

Description

@ScatteredComet

Describe the bug

If you enable ty and ruff via python-lsp, ruff overrides ty and no ty errors are shown.

If you disable pylsp then ty begins reporting errors again.

Environment

  • marimo 0.25.1 (Linux; the relevant frontend code looks unchanged on main)
  • ty 0.0.112
  • python-lsp-server + python-lsp-ruff

Steps to reproduce

  1. Enable both servers via a pyproject.toml
    [tool.marimo.language_servers.pylsp]
    enabled = true
    
    [tool.marimo.language_servers.ty]
    enabled = true
    
    [tool.marimo.diagnostics]
    enabled = true
  2. In a cell, write code that has a type error but nothing ruff would flag, e.g.:
    def scale(x: float, factor: float = "2") -> float:
        return x * factor
  3. No diagnostics appear on the cell at all, even though ty reports invalid-parameter-default (see log below).
  4. Set pylsp.'s enabled = false and restart. The ty error now appears.

Evidence that ty is working

~/.cache/marimo/logs/ty-lsp.log shows ty working and connecting to an LSP.

I haven't tested other combinations of language servers.

Likely cause

Diagnostics from one server seem to overwrite the other's. In the browser console, ty's diagnostic is applied and then an empty publishDiagnostics, likely from pylsp, clears it:

[lsp] diagnostics for cell Hbol [Object]
[lsp] clearing diagnostics Set(1)

Related

Will you submit a PR?

  • Yes

Environment

{
"marimo": "0.23.10",
"editable": false,
"location": "/nix/store/3xi480fg2s9qpabvxz90vp47p7wgw7fw-python3.13-marimo-0.23.10/lib/python3.13/site-packages/marimo",
"OS": "Linux",
"OS Version": "6.17.4-76061704-generic",
"Processor": "",
"Python Version": "3.13.18",
"Locale": "--",
"Binaries": {
"Browser": "149.0.7827.155",
"Node": "--",
"uv": "0.11.21 (x86_64-unknown-linux-gnu)"
},
"Dependencies": {
"click": "8.3.1",
"docutils": "0.22.4",
"itsdangerous": "2.2.0",
"jedi": "0.20.0",
"markdown": "3.10.2",
"narwhals": "2.16.0",
"packaging": "26.1",
"psutil": "7.2.2",
"pygments": "2.20.0",
"pymdown-extensions": "10.21.3",
"pyyaml": "6.0.3",
"starlette": "1.1.0",
"tomlkit": "0.14.0",
"typing-extensions": "4.16.0",
"uvicorn": "0.40.0",
"websockets": "16.0"
},
"Optional Dependencies": {
"loro": "1.13.1"
},
"Experimental Flags": {
"external_agents": false
}
}

Code to reproduce

See above

Activity

  1. added
    bug
    on Nov 28, 2026
  2. ScatteredComet commented on Nov 28, 2026

    @ScatteredComet
    Author

    I just tested on marimo 0.26.0 and the same bug still happens

  3. ScatteredComet commented on Nov 28, 2026

    @ScatteredComet
    Author

    Claude made a fix:

    https://github.com/ScatteredComet/marimo/tree/fix-lsp-diagnostics

    and I made a wheel for this custom build:

    https://github.com/ScatteredComet/marimo/releases/tag/0.26.0-lspfix

    using this in my current setup fixes the issues. Since I haven't written this fix myself I won't submit a PR, but hopefully it illustrates what the issue is. Also note that ty has to be installed via pypi-dependencies otherwise it doesnt work.

  4. mscolnick commented on Nov 30, 2026

    @mscolnick
    Contributor

    @ScatteredComet - feel free to make a PR against our repo and we can review it. thanks for investigating

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions