{"record":{"id":"73de2e25ede6e2ff","repo":"astral-sh/ruff","slug":"expected-an-import-binding-to-have-a-non-empty-qua","errorCode":null,"errorMessage":"Expected an import binding to have a non-empty qualified name; got {qualified_name}","messagePattern":"Expected an import binding to have a non-empty qualified name; got (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/ruff_linter/src/rules/pyflakes/rules/unused_import.rs","lineNumber":547,"sourceCode":"    scope: ScopeId,\n}\n\nimpl ImportBinding<'_> {\n    /// The symbol that is stored in the outer scope as a result of this import.\n    ///\n    /// For example:\n    /// - `import foo` => `foo` symbol stored in outer scope\n    /// - `import foo as bar` => `bar` symbol stored in outer scope\n    /// - `from foo import bar` => `bar` symbol stored in outer scope\n    /// - `from foo import bar as baz` => `baz` symbol stored in outer scope\n    /// - `import foo.bar` => `foo` symbol stored in outer scope\n    fn symbol_stored_in_outer_scope(&self) -> &str {\n        match &self.import {\n            AnyImport::FromImport(_) => self.name,\n            AnyImport::Import(_) => self.name,\n            AnyImport::SubmoduleImport(SubmoduleImport { qualified_name }) => {\n                qualified_name.segments().first().unwrap_or_else(|| {\n                    panic!(\n                        \"Expected an import binding to have a non-empty qualified name;\n                        got {qualified_name}\"\n                    )\n                })\n            }\n        }\n    }\n}\n\nimpl Ranged for ImportBinding<'_> {\n    fn range(&self) -> TextRange {\n        self.range\n    }\n}\n\n/// Generate a [`Fix`] to remove unused imports from a statement.\nfn fix_by_removing_imports<'a>(\n    checker: &Checker,","sourceCodeStart":529,"sourceCodeEnd":565,"githubUrl":"https://github.com/astral-sh/ruff/blob/26f38c119cac42e4d320ba08f09224fdec74af2c/crates/ruff_linter/src/rules/pyflakes/rules/unused_import.rs#L529-L565","documentation":"An unreachable! in ImportBinding::symbol_stored_in_outer_scope: the semantic model produced an import binding whose qualified name is empty, which the rule assumes can never happen because every import binds a non-empty symbol. Firing it signals corrupted semantic data for the import, not a user configuration problem.","triggerScenarios":"Thrown at crates/ruff_linter/src/rules/pyflakes/rules/unused_import.rs:547 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Investigate how the binding with an empty qualified name was created in the semantic model","Skip bindings with empty qualified names defensively in the rule"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"26f38c119cac42e4d320ba08f09224fdec74af2c","analyzedAt":"2026-09-05T10:32:37.492Z","contentChangedAt":"2026-09-05T10:32:37.492Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}