Skip to content

Semantic Errors (E2xxx)

Back to Error Reference

These errors occur during Stage 3 (Semantic Analysis) when the compiler validates types, scopes, and contract structure.

CodeNameDescriptionCommon Cause
E2001UndefinedVariableUndefined variableTypo in variable name, missing declaration
E2002TypeMismatchType mismatchAssigning incompatible types (e.g., address to uint256)
E2003DuplicateDefinitionDuplicate definitionTwo functions/variables with the same name in the same scope
E2004UndefinedFunctionUndefined functionCalling a function that does not exist
E2005UndefinedTypeUndefined typeUsing a struct or contract name that is not defined
E2006InvalidAssignmentInvalid assignmentAssigning to a constant or read-only value
E2007ImmutableModificationCannot modify immutable valueWriting to an immutable or constant variable
E2008VisibilityErrorVisibility errorCalling a private function from outside its contract
E2009InvalidOverrideInvalid overrideOverride without virtual/override keywords
E2010MissingReturnMissing return statementNon-void function path without return
E2011UnreachableCodeUnreachable codeCode after return, revert, or require(false)
E2012UnusedVariableUnused variableDeclared variable never read
E2013UnusedFunctionUnused functionInternal function never called
E2014ShadowedVariableVariable shadows outer scopeLocal variable hides a state variable
E2015InvalidModifierInvalid modifierModifier used incorrectly or on wrong function type

Example: E2002 TypeMismatch

error[E2002]: type mismatch: expected uint256, found address
  --> MyContract.sol:15:5
   |
15 |     uint256 x = msg.sender;
   |     ^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: use explicit cast: uint256(uint160(msg.sender))

Fix: Correct the type usage. In Neo DevPack for Solidity, addresses and integers are distinct types just as in standard Solidity. Use explicit casts when conversion is intentional.

Example: E2003 DuplicateDefinition

error[E2003]: duplicate definition: function 'transfer' already defined
  --> MyContract.sol:25:5

Fix: Rename one of the conflicting definitions, or use function overloading with different parameter signatures.

MIT Licensed