Skip to content

Error Reference

Complete reference for all error codes, warning codes, and diagnostic output produced by the Neo Solidity compiler.

Error and Warning System Overview

The compiler uses a structured diagnostic system with four severity levels:

SeverityBehavior
errorCompilation fails. Must be fixed before artifacts can be generated.
warningCompilation succeeds, but the issue should be reviewed. Can be promoted to error with --Werror.
infoInformational note. Does not affect compilation.
hintSuggestion for improvement. Does not affect compilation.

Each diagnostic includes:

  • A numeric error code (format E<NNNN>)
  • A human-readable message
  • Source location (file, line, column) when available
  • Optional fix suggestions

Error Code Format

Error codes follow the pattern E<NNNN> where the first digit indicates the category:

RangeCategory
E1xxxParse errors -- syntax and tokenization
E2xxxSemantic errors -- types, scopes, validation
E25xxType errors -- overflow, bounds, casts
E3xxxCodegen errors -- bytecode generation, NeoVM limits
E4xxxI/O errors -- files, imports, permissions
E5xxxSecurity warnings -- reentrancy, unsafe patterns

Parse Errors (E1xxx)

These errors occur during Stage 1 (Frontend) when the solang-parser processes Solidity source code. Parse errors block all subsequent compilation stages.

CodeNameDescriptionCommon Cause
E1001UnexpectedTokenUnexpected token in inputTypo, missing operator, wrong syntax
E1002UnexpectedEofUnexpected end of fileUnclosed brace, missing semicolon at EOF
E1003InvalidSyntaxInvalid syntaxUnsupported Solidity syntax construct
E1004MissingSemicolonMissing semicolonStatement not terminated
E1005MissingBraceMissing braceUnclosed { or extra }
E1006InvalidNumberInvalid number literalMalformed hex, overflow in literal
E1007InvalidStringInvalid string literalUnclosed string, invalid escape sequence
E1008InvalidIdentifierInvalid identifierReserved word used as identifier

TIP

Parse errors must be fixed first. The compiler cannot proceed to semantic analysis or code generation until all parse errors are resolved.

Example: E1005 MissingBrace

error[E1005]: missing closing brace
  --> MyContract.sol:42:1
   |
42 | function transfer(address to, uint256 amount) public {
   |                                                       ^ expected matching '}'

Fix: Ensure every { has a corresponding }. Check for accidentally deleted lines or copy-paste errors.

Semantic Errors (E2xxx)

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 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.

Type Errors (E25xx)

CodeNameDescriptionCommon Cause
E2501IntegerOverflowInteger overflowCompile-time constant exceeds type range
E2502IntegerUnderflowInteger underflowCompile-time constant below type minimum
E2503DivisionByZeroDivision by zeroCompile-time division by zero constant
E2504ArrayOutOfBoundsArray index out of boundsCompile-time index exceeds fixed array length
E2505InvalidCastInvalid type castIncompatible explicit cast (e.g., string to uint)
E2506NullReferenceNull referenceAccessing member on potentially null reference

Example: E2501 IntegerOverflow

error[E2501]: integer overflow: value 999999999999999999999 exceeds uint256 range
  --> MyContract.sol:8:20

Fix: Use a value within the valid range for the target type, or split the computation across multiple steps.

Codegen Errors (E3xxx)

These errors occur during Stage 5 (IR Generation) or Stage 7 (Code Generation) when the compiler translates Solidity constructs to NeoVM bytecode.

CodeNameDescriptionCommon Cause
E3001UnsupportedFeatureUnsupported featureUsing EVM-only features (delegatecall, inline assembly, selfdestruct)
E3002InvalidBytecodeInvalid bytecodeInternal compiler error during bytecode emission
E3003StackOverflowStack overflowExpression too deeply nested for NeoVM stack
E3004GasLimitExceededGas limit exceededContract initialization exceeds gas budget
E3005ContractTooLargeContract too largeGenerated bytecode exceeds NEF size limit
E3006InvalidOpcodeInvalid opcodeInternal error: generated opcode not in NeoVM spec
E3007BreakOutsideLoopBreak outside loopbreak statement not inside a for/while loop
E3008ContinueOutsideLoopContinue outside loopcontinue statement not inside a for/while loop
E3009InvalidJumpOffsetInvalid jump offsetInternal error: jump target out of bytecode range

Example: E3001 UnsupportedFeature

error[E3001]: unsupported feature: delegatecall is not available on NeoVM
  --> MyContract.sol:30:9
   |
30 |         target.delegatecall(data);
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^

Blocked features include:

  • delegatecall / staticcall (EVM-specific call semantics)
  • Inline assembly (assembly { ... })
  • selfdestruct
  • Bytecode introspection (extcodesize, extcodecopy)
  • CREATE2 opcode semantics
  • block.difficulty / block.prevrandao
  • tx.gasprice

Fix: Refactor to use Neo-native patterns. See Solidity Feature Support for the full compatibility matrix and Parity and Limitations for details.

Example: E3003 StackOverflow

error[E3003]: stack overflow: expression nesting depth exceeds NeoVM limit
  --> MyContract.sol:45:9

Fix: Break deeply nested expressions into intermediate variables. NeoVM has a maximum evaluation stack depth of 2048 items, but deeply nested expressions can exhaust this limit during evaluation.

Example: E3005 ContractTooLarge

error[E3005]: contract too large: generated bytecode (524,800 bytes) exceeds NEF limit (524,288 bytes)

Fix: Reduce contract size by:

  • Increasing the optimization level (-O 3)
  • Splitting the contract into multiple smaller contracts
  • Removing unused functions and dead code
  • Using external library contracts for shared logic

WARNING

The NEF format has a maximum script size of 512 KB (524,288 bytes). Contracts approaching this limit should be refactored into smaller modules.

I/O Errors (E4xxx)

CodeNameDescriptionCommon Cause
E4001FileNotFoundFile not foundSource file path does not exist
E4002PermissionDeniedPermission deniedCannot read source file or write output
E4003ImportNotFoundImport not foundImported file not found in any include path
E4004CircularImportCircular import detectedFile A imports B which imports A

Example: E4003 ImportNotFound

error[E4003]: import not found: '@neo/devpack/NeoToken.sol'
  --> MyContract.sol:3:1
   |
 3 | import "@neo/devpack/NeoToken.sol";
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Fix: Add the correct include path:

bash
neo-solc contract.sol -I devpack -I ./node_modules -o build/

Checklist:

  • Verify the import path matches the actual file location
  • Check that -I paths are relative to the working directory or absolute
  • Ensure no typos in the import statement
  • For devpack imports, ensure the devpack/ directory is present in the project

Example: E4004 CircularImport

error[E4004]: circular import detected: A.sol -> B.sol -> A.sol

Fix: Break the circular dependency by extracting shared types into a third file that both can import, or restructure the contract hierarchy.

Security Warnings (E5xxx)

CodeNameDescriptionRecommendation
E5001ReentrancyRiskPotential reentrancy vulnerabilityUse checks-effects-interactions pattern
E5002UncheckedCallUnchecked external callCheck return value of external calls
E5003TxOriginUsagetx.origin used for authorizationUse msg.sender instead
E5004UnsafeDelegateUnsafe delegatecalldelegatecall is blocked on NeoVM; refactor
E5005IntegerOverflowRiskPotential integer overflowUse SafeMath or Solidity 0.8.x checked arithmetic

WARNING

Security warnings (E5xxx) should be treated as errors in production builds. Use --Werror E5 to enforce this in your CI pipeline.

Example: E5001 ReentrancyRisk

warning[E5001]: potential reentrancy vulnerability in function 'withdraw'
  --> MyContract.sol:20:5
   |
20 |     payable(msg.sender).transfer(balance);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: move state changes before external calls (checks-effects-interactions pattern)

Fix: Reorder operations so state changes happen before external calls:

solidity
// Before (vulnerable)
function withdraw() public {
    uint256 balance = balances[msg.sender];
    payable(msg.sender).transfer(balance);  // external call first
    balances[msg.sender] = 0;               // state change after
}

// After (safe)
function withdraw() public {
    uint256 balance = balances[msg.sender];
    balances[msg.sender] = 0;               // state change first
    payable(msg.sender).transfer(balance);  // external call after
}

Manifest Warning Codes

These are string-based warning codes emitted during manifest generation (Stage 8):

CodeDescriptionTrigger
COMPILER_WARNINGGeneral compiler warningVarious conditions
NEF_SOURCE_TRUNCATEDNEF source field truncated--nef-source value exceeds 240 bytes
MANIFEST_FULL_WILDCARDFull wildcard permissionManifest requires {"contract":"*","methods":"*"}
MANIFEST_WILDCARD_CONTRACTWildcard contract permissionManifest requires {"contract":"*",...}
MANIFEST_WILDCARD_METHODSWildcard method permissionManifest requires {...,"methods":"*"}

Constructor Deploy Warning

When a contract has a parameterised constructor, the compiler emits a warning if the manifest does not include StdLib.jsonDeserialize and StdLib.deserialize permissions. The injected deploy prologue uses these methods to parse constructor arguments.

warning: contract 'MyToken' has a parameterised constructor; deploy it by passing
constructor args through `_deploy(data, update)`. Neo-Express: pass a JSON array
string via `-d '[7]'`; SDKs that support StackItems may pass an Array directly.

Fix: Ensure the manifest permissions include StdLib access, or pass constructor arguments as a StackItem Array directly from your SDK.

Internal Error Types

The compiler uses several internal error categories that appear in JSON diagnostic output:

TypeSourceDescription
CompilerErrorValidation and semantic analysisStandard compilation errors with E-codes
IrGenerationIR lowering (Stage 5)Errors during IR generation with context
ManifestGenerationArtifact builder (Stage 8)Manifest permission policy violations
GenericVarious stagesCatch-all for unclassified errors

IR generation errors include additional context fields in JSON output:

json
{
  "component": "neo-solidity",
  "severity": "error",
  "type": "IrGeneration",
  "message": "unsupported feature: inline assembly",
  "functionName": "computeHash",
  "errorCode": "E3001",
  "suggestion": "Use CryptoLib.sha256() from the devpack instead"
}

Diagnostic Output Formats

Human-Readable (default)

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))

JSON Lines (--json-errors, --json-warnings)

Each diagnostic is a single JSON object on one line of stderr:

json
{
  "component": "neo-solidity",
  "severity": "error",
  "type": "CompilerError",
  "code": "E2002",
  "message": "type mismatch: expected uint256, found address",
  "formattedMessage": "type mismatch: expected uint256, found address",
  "location": {
    "file": "MyContract.sol",
    "line": 15,
    "column": 5
  }
}

Warning Suppression and Promotion

Suppress warnings by code prefix

bash
# Suppress all unused-variable warnings (E2012)
neo-solc contract.sol --Wno E2012 -I devpack -o build/

# Suppress all semantic warnings (E2xxx)
neo-solc contract.sol --Wno E2 -I devpack -o build/

Promote warnings to errors

bash
# Treat all security warnings as errors
neo-solc contract.sol --Werror E5 -I devpack -o build/

# Treat specific warning as error
neo-solc contract.sol --Werror E5001 -I devpack -o build/

Combine suppression and promotion

bash
# Errors on security, suppress unused variables
neo-solc contract.sol --Werror E5 --Wno E2012 -I devpack -o build/

Debugging Workflow

A step-by-step approach to resolving compilation failures:

  1. Compile with full diagnostics:

    bash
    neo-solc contract.sol -I devpack --json-errors --json-warnings -o build/ 2>diag.jsonl
  2. Fix highest-severity errors first. Parse errors (E1xxx) block all later stages. Fix them before addressing semantic errors.

  3. Address semantic errors (E2xxx). These are type and scope issues in your Solidity code.

  4. Review codegen errors (E3xxx). These usually indicate unsupported EVM features that need refactoring for NeoVM.

  5. Run with manifest safety flags:

    bash
    neo-solc contract.sol -I devpack \
      --deny-wildcard-permissions \
      --deny-wildcard-contracts \
      -o build/
  6. Validate with Neo-Express smoke tests before deploying to testnet or mainnet.

TIP

Use -v (verbose) to see optimization statistics and IR details. This can help diagnose unexpected bytecode size or behavior.

Platform-Specific Notes

Linux

Ensure libclang is installed for the solang-parser dependency:

bash
apt-get install libclang-dev

macOS

Xcode command-line tools are required:

bash
xcode-select --install

Windows

Visual Studio Build Tools and the Rust MSVC target are required.

See Also

MIT Licensed