diff --git a/client/commands/v2/pysa_server.py b/client/commands/v2/pysa_server.py index 26c13376757..2990021330e 100644 --- a/client/commands/v2/pysa_server.py +++ b/client/commands/v2/pysa_server.py @@ -91,9 +91,14 @@ def invalid_models_to_diagnostics( ) -> Dict[Path, List[lsp.Diagnostic]]: result: Dict[Path, List[lsp.Diagnostic]] = {} for model in invalid_models: - result.setdefault(Path(model.path), []).append( - self.invalid_model_to_diagnostic(model) - ) + if model.path is None: + self.log_and_show_message_to_client( + "Path cannot be None", lsp.MessageType.WARNING + ) + else: + result.setdefault(Path(model.path), []).append( + self.invalid_model_to_diagnostic(model) + ) return result async def update_errors(self, document_path: Path) -> None: