You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
src/core/models.py — Django custom User model with email-based auth:
"""Custom User model using email as the login identifier instead of username."""fromtypingimportAny, ClassVarfromdjango.contrib.auth.base_userimport (
AbstractBaseUser,
BaseUserManager,
)
fromdjango.contrib.auth.modelsimportPermissionsMixinfromdjango.db.modelsimportBooleanField, CharField, EmailFieldclassUserManagement(BaseUserManager["User"]):
defcreate_user(
self, email: str, password: str|None=None, **extra_fields: Any
) ->"User":
ifnotemail:
raiseValueError("Users must have an email address")
user: User=self.model(email=self.normalize_email(email), **extra_fields)
user.set_password(password)
user.save(using=self._db)
returnuserdefcreate_superuser(self, email: str, password: str) ->"User":
user: User=self.create_user(email=email, password=password)
user.is_staff=Trueuser.is_superuser=Trueuser.save(using=self._db)
returnuserclassUser(AbstractBaseUser, PermissionsMixin):
email=EmailField(max_length=255, unique=True)
name=CharField(max_length=255)
is_active=BooleanField(default=True) # type: ignore[bad-override]is_staff=BooleanField(default=False)
objects: ClassVar[UserManagement] =UserManagement()
USERNAME_FIELD="email"
What happens
Opening this file in VS Code causes the Pyrefly LSP to panic immediately during the initial indexing phase (DidOpenTextDocument). The server crashes 5 times and stops restarting.
Crash log
starting generic LSP server
INFO Reading messages
INFO File src/core/models.py opened, prepare to validate open files.
INFO Ran task on sourcedb_queue heavy task queue. Queue time: 0.00, task time: 0.00
INFO Published 0 diagnostics for file:///…/src/core/models.py
INFO Validated open files and committed transaction.
INFO Cleared 1 dropped configs from config cache
INFO Language server processed event `DidOpenTextDocument` in 1.21s (0.00s waiting)
WARN /var/folders/…/pyrefly_bundled_typeshed_e52a9c11f401/pyrefly.toml: Cannot use both `permissive-ignores` and `enabled-ignores`: `permissive-ignores` will be ignored.
INFO Unhandled notification: Notification { method: "$/setTrace", params: Object {"value": String("off")}, activity_key: None }
[Error] Client Pyrefly language server: connection to server is erroring.
write EPIPE
ERROR Thread panicked, shutting down: panicked at pyrefly/lib/alt/answers_solver.rs:233:66:
called `Option::unwrap()` on a `None` value
Backtrace:
0: <std::backtrace::Backtrace>::create
1: <std::sync::once::Once>::call_once::<pyrefly_util::panic::print_panic::{closure#0}>::{closure#0}
2: <std::sys::sync::once::queue::Once>::call
3: pyrefly_util::panic::print_panic
4: pyrefly_util::panic::exit_on_panic::{closure#0}
5: std::panicking::panic_with_hook
6: std::panicking::panic_handler::{closure#0}
7: std::sys::backtrace::__rust_end_short_backtrace::<std::panicking::panic_handler::{closure#0}, !>
8: __rustc::rust_begin_unwind
9: core::panicking::panic_fmt
10: core::panicking::panic
11: core::option::unwrap_failed
12: <pyrefly::alt::answers_solver::AnswersSolver<pyrefly::state::state::TransactionHandle>>::get_idx::<pyrefly::binding::binding::KeyClassField>
13: <pyrefly::alt::answers_solver::AnswersSolver<pyrefly::state::state::TransactionHandle>>::get_from_module::<pyrefly::binding::binding::KeyClassField>
14: <pyrefly::alt::answers_solver::AnswersSolver<pyrefly::state::state::TransactionHandle>>::get_non_synthesized_field_from_current_class_only
15: <pyrefly::alt::answers_solver::AnswersSolver<pyrefly::state::state::TransactionHandle>>::get_class_member_with_defining_class
16: <pyrefly::state::steps::Step>::step_solutions::<pyrefly::state::state::TransactionHandle>
17: <pyrefly::state::steps::Step>::compute::<pyrefly::state::state::TransactionHandle>
18: <pyrefly::state::state::Transaction>::demand
19: <pyrefly::state::state::Transaction>::run_step::{closure#1}
20: <rayon_core::job::HeapJob<…> as rayon_core::job::Job>::execute
21: <rayon_core::registry::WorkerThread>::wait_until_cold
22: std::sys::backtrace::__rust_end_short_backtrace::<…>
23: <std::thread::lifecycle::spawn_unchecked<…>>::call_once::{shim:vtable#0}
24: <std::sys::thread::unix::Thread>::new::thread_start
25: __pthread_cond_wait
PANIC Sorry, Pyrefly crashed, this is always a bug in Pyrefly itself.
PANIC Please report the bug at https://github.com/facebook/pyrefly/issues/new
[Error] Server process exited with code 101.
[Error] The Pyrefly language server server crashed 5 times in the last 3 minutes. The server will not be restarted.
Additional notes
The panic happens during DidOpenTextDocument processing, before any interactive LSP requests (no codeAction, documentSymbol etc.)
The write EPIPE on the Node.js side is a consequence of the Rust thread panic closing the pipe, not a separate cause
The bundled pyrefly.toml warning (Cannot use both permissive-ignores and enabled-ignores) appears on every startup — possible related config issue in the bundled typeshed
Pyrefly CLI (pyrefly check) works fine on the same file — crash is LSP-only
Environment
Reproducible file
src/core/models.py— Django custom User model with email-based auth:What happens
Opening this file in VS Code causes the Pyrefly LSP to panic immediately during the initial indexing phase (
DidOpenTextDocument). The server crashes 5 times and stops restarting.Crash log
Additional notes
DidOpenTextDocumentprocessing, before any interactive LSP requests (nocodeAction,documentSymboletc.)write EPIPEon the Node.js side is a consequence of the Rust thread panic closing the pipe, not a separate causepyrefly.tomlwarning (Cannot use both permissive-ignores and enabled-ignores) appears on every startup — possible related config issue in the bundled typeshedpyrefly check) works fine on the same file — crash is LSP-onlyanswers_solver.rs:233) is different from the previously fixed Django panic in Panic inpyrefly/lib/alt/answers_solver.rs#1527 (answers_solver.rs:650)