Solidity — All About Compiler Errors

Jean Cvllr
11 min readApr 8, 2023
image by Etienne Girardet on Unsplash

This article is Part I of the “All About Errors” sub-series.

We will now look in more details at a first broad category of errors in Solidity: errors related to the Solidity compiler, known as “Compile Time Errors” or “Compiler Errors”.

As you will see, the Solidity compiler solc generates different type of errors when compiling Solidity code into bytecode. Each of these relate to different reason making the compiler abort.

Table of Content
- Introduction to Compile Time Errors
- Solc CLI Errors
- Compiler Errors - Overview
- Warnings
- Parser Error
- Docstring Parser Error
- Syntax Error
- Declaration Error
- Type Error
- Unimplemented Feature Error
- Crash Errors

Introduction to Compile Time Errors

Compile time errors, as the name suggests, are errors that occur at the time a Solidity contract is compiled by the solc compiler.

They appear in the IDE (Remix, VS Code…) if your IDE is programmed with some plugins (like Solidity Visual Developer for VS Code) or in the terminal when running the command to compile.

When solc is used to compiler a Solidity smart contract, it takes a .sol file and its content as input to generate an output: the EVM bytecode of the smart contract. But at the time of compilation, things can go wrong and errors can occur. That’s the reason we call this high level category of errors compile time errors.

Solidity Compile Time errors can be divided into two big groups:

  • Solc CLI Errors
  • Compiler Errors

Solc CLI Errors

These are errors related to when using the solc compiler via the command line.

  1. JSONError: JSON input doesn’t conform to the required format, e.g. input is not a JSON object, the language is not supported, etc.
  2. IOError: IO and import processing errors, such as unresolvable URL or hash mismatch in supplied sources.

Compiler Errors — Overview

This category of compile-time errors occurs when the Solidity code is being compiled to executable bytecode.