Error codes
The Scala 3 compiler assigns a unique error code to each type of error it can emit. These codes appear in compiler output in the format [E001], [E007], etc.
This section documents each error code with:
- Description — what the error means and when it occurs
- Example — code that triggers the error
- Error output — the actual compiler message you'll see
- Solution — how to fix the problem
Using error codes
When you encounter an error, you can use the -explain flag to get more detailed information:
scala compile -explain MyFile.scala
You can also look up any error code directly in this documentation by its number (e.g., E007 for type mismatch errors).
Browse the full list in the sidebar to find documentation for any specific error code.
Table of Contents
- E001: Empty Catch Block
- E002: Empty Catch And Finally Block
- E003: Deprecated With Operator
- E004: Case Class Missing Param List
- E005: Duplicate Bind
- E006: Missing Ident
- E007: Type Mismatch
- E008: Not A Member
- E009: Early Definitions Not Supported
- E010: Top Level Implicit Class
- E011: Implicit Case Class
- E012: Implicit Class Primary Constructor Arity
- E013: Object May Not Have Self Type
- E014: Tuple Too Long
- E015: Repeated Modifier
- E016: Interpolated String Error
- E017: Unbound Placeholder Parameter
- E018: Illegal Start Simple Expr
- E019: Missing Return Type
- E020: Yield Or Do Expected In For Comprehension
- E021: Proper Definition Not Found
- E022: By Name Parameter Not Supported
- E023: Wrong Number Of Type Args
- E024: Illegal Variable In Pattern Alternative
- E025: Identifier Expected
- E026: Auxiliary Constructor Needs Non-Implicit Parameter
- E027: Varargs Parameter Must Come Last
- E028: Illegal Literal
- E029: Pattern Match Exhaustivity
- E030: Match Case Unreachable
- E031: Sequence Wildcard Pattern Position
- E032: Illegal Start Of Simple Pattern
- E033: Package Duplicate Symbol
- E034: Existential Types No Longer Supported
- E035: Unbound Wildcard Type
- E036: Dangling This In Path
- E037: Overrides Nothing
- E038: Overrides Nothing But Name Exists
- E039: Forward Reference Extends Over Definition
- E040: Expected Token But Found
- E041: Mixed Left And Right Associative Ops
- E042: Cannot Instantiate Abstract Class Or Trait
- E043: Unreducible Application
- E044: Overloaded Or Recursive Method Needs Result Type
- E045: Recursive Value Needs Result Type
- E046: Cyclic Reference Involving
- E047: Cyclic Reference Involving Implicit
- E048: Super Qualifier Must Be Parent
- E049: Ambiguous Reference
- E050: Method Does Not Take Parameters
- E051: Ambiguous Overload
- E052: Reassignment To Val
- E053: Type Does Not Take Parameters
- E054: Parameterized Type Lacks Arguments
- E055: Var Val Parameters May Not Be Call By Name
- E056: Missing Type Parameter For
- E057: Does Not Conform To Bound
- E058: Does Not Conform To Self Type
- E059: Does Not Conform To Self Type Cannot Be Instantiated
- E060: Abstract Member May Not Have Modifier
- E061: Top Level Can't Be Implicit
- E062: Types And Traits Cannot Be Implicit
- E063: Only Classes Can Be Abstract
- E064: Abstract Override Only In Traits
- E065: Traits May Not Be Final
- E066: Native Members May Not Have Implementation
- E067: Only Classes Can Have Declared But Undefined Members
- E068: Cannot Extend AnyVal
- E069: Cannot Have Same Name As
- E070: Value Classes May Not Define Inner Class
- E071: Value Classes May Not Define Non Parameter Field
- E072: Value Classes May Not Define A Secondary Constructor
- E073: Value Classes May Not Contain Initialization
- E074: Value Classes May Not Be Abstract
- E075: Value Classes May Not Be Contained
- E076: Value Classes May Not Wrap Another Value Class
- E077: Value Class Parameter May Not Be A Var
- E078: Value Class Needs Exactly One Val Parameter
- E079: Only Case Class Or Case Object Allowed
- E080: Expected Top Level Def
- E081: Anonymous Function Missing Parameter Type
- E082: Super Calls Not Allowed In Inlineable
- E083: Not A Path
- E084: Wildcard On Type Argument Not Allowed On New
- E085: Function Type Needs Non-Empty Parameter List
- E086: Wrong Number Of Parameters
- E087: Duplicate Private Protected Qualifier
- E088: Expected Start Of Top Level Definition
- E089: Missing Return Type With Return Statement
- E090: No Return From Inlineable
- E091: Return Outside Method Definition
- E092: Unchecked Type Pattern
- E093: Extend Final Class
- E094: Enum Case Definition In Non-Enum Owner
- E095: Expected Type Bound Or Equals
- E096: Class And Companion Name Clash
- E097: Tailrec Not Applicable
- E098: Failure To Eliminate Existential
- E099: Only Functions Can Be Followed By Underscore
- E100: Missing Empty Argument List
- E101: Duplicate Named Type Parameter
- E102: Undefined Named Type Parameter
- E103: Illegal Start of Statement
- E104: Trait Is Expected
- E105: Trait Redefined Final Method From AnyRef
- E106: Package Name Already Defined
- E107: Unapply Invalid Number of Arguments
- E108: Unapply Invalid Return Type
- E109: Static Fields Only Allowed in Objects
- E110: Cyclic Inheritance
- E111: Bad Symbolic Reference
- E112: Unable to Extend Sealed Class
- E113: Symbol Has Unparsable Version Number
- E114: Symbol Changed Semantics In Version
- E115: Unable to Emit Switch
- E116: Missing Companion for Static
- E117: Polymorphic Method Missing Type in Parent
- E118: Params No Inline
- E119: Symbol Is Not a Value
- E120: Double Definition
- E121: Match Case Only Null Warning
- E122: Imported Twice
- E123: Type Test Always Diverges
- E124: Term Member Needs Result Type for Implicit Search
- E125: Class Cannot Extend Enum
- E126: Value Class Parameter May Not Be Call-By-Name
- E127: Not An Extractor
- E128: Member With Same Name As Static
- E129: Pure Expression In Statement Position
- E130: Trait Companion With Mutable Static
- E131: Lazy Static Field
- E132: Static Overriding Non-Static Members
- E133: Overload In Refinement
- E134: No Matching Overload
- E135: Stable Identifier Pattern
- E136: Static Fields Should Precede Non-Static
- E137: Illegal Super Accessor
- E138: Trait Parameter Used As Parent Prefix
- E139: Unknown Named Enclosing Class Or Object
- E140: Illegal Cyclic Type Reference
- E141: Missing Type Parameter In Type App
- E142: Skolem in Inferred
- E143: Erased Types Can Only Be Function Types
- E144: Case Class Missing Non-Implicit Parameter List
- E145: Enumerations Should Not Be Empty
- E146: Illegal Parameter Initialization
- E147: Redundant Modifier
- E148: Typed Case Does Not Explicitly Extend Typed Enum
- E149: Illegal Redefinition Of Standard Kind
- E150: No Extension Method Allowed
- E151: Extension Method Cannot Have Type Parameters
- E152: Extension Can Only Have Defs
- E153: Unexpected Pattern For SummonFrom
- E154: Anonymous Instance Cannot Be Empty
- E155: Type Splice in Val Pattern
- E156: Modifier Not Allowed For Definition
- E157: Cannot Extend Java Enum
- E158: Invalid Reference In ImplicitNotFound Annotation
- E159: Trait May Not Define Native Method
- E160: Java Enum Parent Args
- E161: Already Defined
- E162: Case Class In Inlined Code
- E163: Override Type Mismatch Error
- E164: Override Error
- E165: Matchable Warning
- E166: Cannot Extend Function
- E167: Lossy Widening Constant Conversion
- E168: Implicit Search Too Large
- E169: TargetName On Top-Level Class
- E170: Not Class Type
- E171: Missing Argument
- E172: Missing Implicit Argument
- E173: Cannot Be Accessed
- E174: Inline Given Should Not Be Function
- E175: Value Discarding
- E176: Unused Non-Unit Value
- E177: Constructor Proxy Shadows
- E178: Missing Argument List
- E179: Match Type Scrutinee Cannot Be Higher-Kinded
- E180: Ambiguous Extension Method
- E181: Unqualified Call to AnyRef Method
- E182: Not Constant
- E183: Closure Cannot Have Internal Parameter Dependencies
- E184: Match Type No Cases
- E185: Unimported and Imported
- E186: Implausible Pattern Warning
- E187: Synchronized Call on Boxed Class
- E188: VarArgs Param Cannot Be Given
- E189: Extractor Not Found
- E190: Pure Unit Expression
- E191: Match Type Legacy Pattern
- E192: Unstable Inline Accessor
- E193: Volatile on Val
- E194: Extension Nullified by Member
- E195: Phantom Symbol Not Value
- E196: Context Bound Companion Not Value
- E197: Inlined Anonymous Class Warning
- E198: Unused Symbol
- E199: Tailrec Nested Call
- E200: Final Local Def
- E201: Non-Named Argument in Java Annotation
- E202: Quoted Type Missing
- E203: Deprecated Assignment Syntax
- E204: Deprecated Infix Named Argument Syntax
- E205: Given Search Priority Warning
- E206: Enum May Not Be Value Class
- E207: Illegal Unroll Placement
- E208: Extension Has Default Receiver
- E209: Format Interpolation Error
- E210: Value Class Cannot Extend Alias of AnyVal
- E211: Match Is Not Partial Function
- E212: Only Fully Dependent Applied Constructor Type
- E213: Pointless Applied Constructor Type
- E214: Illegal Context Bounds
- E215: Named Pattern Not Applicable
- E216: Unnecessary .nn
- E217: Erased Not Pure
- E218: Illegal Erased Definition
- E219: Cannot Instantiate Quoted Type Variable
- E220: Default Shadows Given
- E221: Recurse With Default
- E222: Encoded Package Name
- E223: Cannot Be Included in Capture Set
- E224: Override Class
- E225: Infer Union Warning
- E226: Type Parameter Shadows Type
- E227: Private Shadows Type
In this article