Solidity syntax errors produce an unexpected `abort` and print two 5's to the console
See original GitHub issueIf the code sent to solc-js contains a syntax error, solc-js will throw an error with the message abort(5)
. It also prints two 5’s to the console. This affects the Truffle stack as all users who accidentally produce syntax errors won’t be able to diagnose the issue.
I’ve written a sample script that reproduces the error:
#!/usr/bin/env node
var solc = require("solc");
var solcStandardInput = {
language: "Solidity",
sources: {
"Contract.sol": {content: "pragma solidity ^0.4.11; contract Contract { this is a syntax error }"}
},
settings: {
optimizer: {
enabled: true,
runs: 0 // See https://github.com/ethereum/solidity/issues/2245
},
}
};
// This error's and prints out two 5's
solc.compileStandardWrapper(JSON.stringify(solcStandardInput));
The output you get looks like this:

Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Truffle console doesn't work :Unexpected error: Cannot ...
I assume that Truffle has a bug that instead of reading the specific files produced by a truffle compile it tries to read...
Read more >Remix Documentation - Read the Docs
1. Click on the script to make it the active tab in the editor. 2. Input the command remix.exeCurrent() in the console. 1.2....
Read more >Solidity Learning: Revert(), Assert(), and Require ... - Medium
If the useSuperPowers() function is called by anyone other than owner , the function will throw returning an invalid opcode error, undoing all...
Read more >Index Of - PHP Advanced Transfer
She will A syntax error has occurred Webbs all play, and their father has not so good an income as yours. Do The...
Read more >javascript toastr laravel Code Example - Code Grepper
2. toast()->message('message', 'level', 'title');. 3. toast('message', 'title');. Source: github.com. Add a Grepper Answer ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This can happen when you declare
struct
memberspublic
:Also compiling files individually (if doing Truffle migrate which is how I got here) can actually throw a usable error message:
solcjs file.sol --abi
It definitely works with 0.4.13: