BSK-E0121 error

Protocol conformance violation in annotated assignment

Detects errors in annotated assignments at module level:

1. **Missing protocol members**: the annotation names a Protocol class and the RHS constructs a class that does not implement all required methods.

2. **Non-protocol structural assignment**: the annotation names a class that inherits from a Protocol but does not itself include Protocol in its bases (i.e. it is a concrete/abstract class, not a protocol). In this case structural subtyping does not apply and only nominal subclasses are allowed.

3. **Member-kind mismatch** (see conformance): a member is present but in an incompatible form — a read-write protocol property satisfied by a read-only/immutable member, or a writable protocol instance variable satisfied by a ClassVar, read-only property, or wrong-typed attribute.

class P(Protocol):
    def method(self) -> None: ...

class NotP(P):           # Note: no Protocol — this is a concrete class
    def method(self) -> None: pass

class C:
    pass

x: P = C()       # E — C does not implement `method` (case 1)
y: NotP = C()    # E — NotP is not a Protocol, no structural subtyping (case 2)

How to handle it

Every rule is on by default — strict is the default, not a cage. You can dial BSK-E0121 down per-file or per-path from your editor or pyproject.toml, or fix the code so it type-checks. See the Type System rules and the complete diagnostic reference.

Canonical URL: https://www.basilisk-python.dev/errors/BSK-E0121