Beacon Diagnostic Codes

Beacon’s Diagnostic provider combines parser feedback, Hindley–Milner type errors, annotation coverage checks, control/data-flow analysis, and workspace import resolution into a single stream of LSP diagnostics.

This guide lists every diagnostic code emitted by that pipeline so you can interpret squiggles quickly and trace them back to the subsystem described in Type Checking, Static Analyzer, and Type Checking Modes.

LSP severity for imports (circular vs. unresolved) remains configurable under [diagnostics] as documented in Configuration. To temporarily suppress any diagnostic, use the mechanisms described in Suppressions.


Legend:

  • ⚠ = Warning
  • ✕ = Error
  • ⓘ = Info/Hints

Note that per-mode rows show the icon used in strict / balanced / relaxed order

CodeNameLevelCategoryDescription
ANY001UnsafeAnyUsage⚠Type SafetyDeep inference found an Any value, reducing type safety.
ANN001AnnotationMismatch✕ ⚠ ⓘAnnotationsDeclared annotation disagrees with the inferred type.
ANN002MissingVariableAnnotation✕ ⚠AnnotationsAssignment lacks an annotation in strict/balanced modes.
ANN003ParameterAnnotationMismatch✕ ⚠ ⓘAnnotationsParameter annotation conflicts with inferred usage.
ANN004MissingParameterAnnotation✕ ⚠AnnotationsParameter missing annotation when inference is precise.
ANN005ReturnAnnotationMismatch✕ ⚠ ⓘAnnotationsFunction return annotation disagrees with inference.
ANN006MissingReturnAnnotation✕ ⚠AnnotationsFunction lacks return annotation when inference is concrete.
ANN007ImplicitAnyParameter✕AnnotationsStrict mode forbids implicit Any on parameters.
ANN008ImplicitAnyReturn✕AnnotationsStrict mode forbids implicit Any return types.
ANN009MissingClassAttributeAnnotation✕AnnotationsStrict mode requires explicit annotations on class attributes.
ANN010BareExceptClause✕AnnotationsStrict mode forbids bare except: clauses without exception types.
ANN011ParameterImplicitAny⚠AnnotationsBalanced mode warns when parameter type resolves to implicit Any.
ANN012ReturnImplicitAny⚠AnnotationsBalanced mode warns when return type resolves to implicit Any.
DUNDER_INFOEntryPointGuardⓘDunder PatternsHighlights if __name__ == "__main__": guard blocks.
DUNDER001MagicMethodOutOfScope⚠Dunder PatternsMagic methods defined outside a class.
DYN001DynamicBoundary✕ ⚠ ⓘDynamic PythonRuntime behavior crosses an Any/unknown boundary.
HM001TypeMismatch✕Type SystemHindley–Milner could not unify two types.
HM002OccursCheckFailed✕Type SystemRecursive type variable detected (infinite type).
HM003UndefinedTypeVar✕Type SystemReferenced type variable was never declared.
HM004KindMismatch✕Type SystemWrong number of type arguments supplied to a generic.
HM005InfiniteType✕Type SystemInference produced a non-terminating type (self-referential).
HM006ProtocolNotSatisfied✕Type SystemValue fails to implement the required protocol methods.
HM007AttributeNotFound✕AttributesAttribute or method does not exist on the receiver type.
HM008ArgumentCountMismatch✕Type SystemCall site passes too many or too few arguments.
HM009ArgumentTypeMismatch✕Type SystemArgument type incompatible with the parameter type.
HM010PatternTypeMismatch✕Pattern TypingMatch/case pattern cannot match the subject type.
HM011KeywordArgumentError✕Type SystemUnknown or duplicate keyword arguments in a call.
HM012GenericTypeError✕Type SystemCatch-all Hindley–Milner error (value restriction, etc.).
HM013PatternStructureMismatch✕Pattern TypingPattern shape (mapping, class, sequence) differs from subject.
HM014VarianceError✕VarianceInvariant/covariant/contravariant constraint violated.
MODE_INFOTypeCheckingModeⓘModeReminder showing which type-checking mode produced diagnostics.
PM001PatternNonExhaustive✕PatternsMatch statement fails to cover every possible case.
PM002PatternUnreachable✕PatternsLater pattern is shadowed by an earlier one.
circular-importCircularImport✕ ⚠ ⓘImportsModule participates in an import cycle (severity comes from config).
missing-moduleMissingModule✕ImportsReferenced module is absent from the workspace/stubs.
shadowed-variableShadowedVariable⚠ScopeInner scope reuses a name that already exists in an outer scope.
undefined-variableUndefinedVariable✕Name ResolutionName used before being defined anywhere.
unresolved-importUnresolvedImport✕ ⚠ ⓘImportsImport target cannot be resolved (severity configurable).
unreachable-codeUnreachableCode⚠Data FlowCode after return, raise, or break never executes.
unused-variableUnusedVariableⓘData FlowVariable assigned but never read.
use-before-defUseBeforeDef✕Data FlowVariable read before it is assigned in the current scope.

Diagnostics by Category