Skip to content

Lsp error/crash when doing single-line multiple-variable assignment to a variable starting with not #3283

@Pluviolithic

Description

@Pluviolithic

Summary

Discovered when editing a line like the following:

something, somethingelse = (1, 2)

to

something, notify = (1, 2)

The lsp errors/crashes on completing the not part of the edit. I tried another keyword like for and did not get the same behavior. I don't believe this occurs when simply doing something like not... = 5. This can also be done in the Playground, just complete no to not and add a newline or something to trigger refresh(?):

Error

Failed to update file: recursive use of an object detected which would lead to unsafe aliasing in rust

It's different from what I get in neovim with the following config (no ty config in the pyproject.toml):

local capabilities = require("cmp_nvim_lsp").default_capabilities()
local lsp_servers = {
    ["ty"] = {
        capabilities = capabilities,
        settings = {
            diagnosticMode = "workspace",
            completions = {
                autoImport = true,
            },
        },
    },

Diagnostic output:

[ERROR][2026-04-15 11:53:37] /usr/share/nvim/runtime/lua/vim/lsp/log.lua:151	"rpc"	"ty"	"stderr"	"2026-04-15 11:53:37.684760920 ERROR An error occurred with request ID 63: request handler panicked at crates/ty_python_semantic/src/types/infer/builder.rs:3084:26:\nexpression should belong to this `UnpackResult` and `Unpacker` should have inferred a type for itquery stacktrace:\n   0: DatabaseKeyIndex(IngredientIndex(177), Id(1c76b))\n\n\nrun with `RUST_BACKTRACE=1` environment variable to display a backtrace\n\n"

Output from running ty check on the malformed file:

error[invalid-syntax]: Invalid assignment target
 --> something.py:1:12
  |
1 | something, not = (1, 2)
  |            ^^^
  |

error[invalid-syntax]: Expected an expression
 --> something.py:1:16
  |
1 | something, not = (1, 2)
  |                ^
  |

Version

ty 0.0.31

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingfatala fatal error (panic or crash)serverRelated to the LSP server

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions