I'm trying to compile my Solidity smart contract, but I keep getting this error: Doc tag @notice not valid for statements.

There is no @notice statement in my code. The error seems to happen with Solidity versions from 0.4 to 0.4.9, with and without optimization.

EDIT: Through divide and conquer I could attribute the error to the following function:

function f(uint blockNumber, bool finalBlock) returns (bool) {
    if (msg.sender != protocolParameters.A)
        return false; // caller is not Alice

    if (blockNumber > protocolValues.blockNumber && blockNumber <= protocolParameters.numberOfBlocks*2) {
        protocolValues.stageNumber = blockNumber*2;

    } else {
        throw; // TODO: is throw angemessen here?
    /// TODO: careful 
    if (finalBlock) {
        protocolValues.phaseNumber = 2; // we go to the TERMINAL phase
        setPayoffs(protocolParameters.DA, protocolParameters.DB + protocolParameters.FV);

    return true;

Any idea?

  • I doubt you'll get a satisfactory answer without showing the offending code. Try to pull out everything that you want to hide, but that still exhibits the problem. This type of question is nearly impossible to answer without code, and just from reading the error message, it appears to be a simple matter of bad syntax as opposed to a compiler bug. – Thomas Jay Rush Apr 20 '17 at 14:26
  • @ThomasJayRush: Done. – Symeof Apr 20 '17 at 14:44

The issue was the following:

/// TODO: careful 

Apparently /// is treated specially by the Solidity compiler and lead to the error.

Removing it fixed the issue.

comments added with /** my comment */ also lead to the error. Notice the double asterisk at the start of the comment


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.