ethereum/go-ethereum · error · Error

You tried to send "${payload.method}" synchronously. Synchro

Error message

You tried to send "${payload.method}" synchronously. Synchronous requests are not supported by the IPC provider.

What it means

IpcProvider.send (synchronous request path) checks whether the underlying connection supports writeSync; when it does not (the bundled IPC connection lacks sync writes in this context), any synchronous RPC attempt is rejected with this error. Only asynchronous requests (sendAsync / callback style) are supported over the IPC provider in this state.

Source

Thrown at internal/jsre/deps/web3.js:4856

    if(this.connection.writeSync) {
        var result;

        // try reconnect, when connection is gone
        if(!this.connection.writable)
            this.connection.connect({path: this.path});

        var data = this.connection.writeSync(JSON.stringify(payload));

        try {
            result = JSON.parse(data);
        } catch(e) {
            throw errors.InvalidResponse(data);                
        }

        return result;

    } else {
        throw new Error('You tried to send "'+ payload.method +'" synchronously. Synchronous requests are not supported by the IPC provider.');
    }
};

IpcProvider.prototype.sendAsync = function (payload, callback) {
    // try reconnect, when connection is gone
    if(!this.connection.writable)
        this.connection.connect({path: this.path});


    this.connection.write(JSON.stringify(payload));
    this._addResponseCallback(payload, callback);
};

module.exports = IpcProvider;


},{"../utils/utils":20,"./errors":26}],35:[function(require,module,exports){
/*

View on GitHub (pinned to 6bb0588ad8)

Solutions

  1. Use the callback form: web3.eth.getBlockNumber(function(err, n) {...}).
  2. Wrap async calls in a promise/utility if sync-looking code style is needed.
  3. If synchronous behavior is truly required, use the HTTP-RPC provider against the node's HTTP endpoint instead of IPC.

Example fix

// before
var n = web3.eth.getBlockNumber(); // throws over IPC

// after
web3.eth.getBlockNumber(function (err, n) { console.log(n); });
Defensive patterns

Strategy: validation

Validate before calling

function assertAsyncCapable(web3) {
  if (web3.currentProvider.constructor.name === 'IpcProvider') {
    // only use callback-style requests with this provider
    return false;
  }
  return true;
}

Type guard

function isIpcProvider(p) {
  return p && typeof p.connection !== 'undefined' && typeof p.path === 'string';
}

Try / catch

try { web3.eth.getBlockNumber(); }
catch (e) {
  if (/IPC provider/.test(e.message)) { web3.eth.getBlockNumber(cb); }
}

Prevention

When it happens

Trigger: Constructing web3 with an IpcProvider over geth.ipc and calling a synchronous method, e.g. web3.eth.getBlockNumber() with no callback while connected via IPC, or console code that expects sync returns over the IPC transport.

Common situations: Scripts built against HttpProvider (which supports sync in browsers/node) switched to IPC unix socket for security/performance; version upgrades of web3.js where sync IPC behavior differs; calling sync RPC from a context where the connection object has no writeSync.

Related errors


AI-assisted analysis of ethereum/go-ethereum@6bb0588ad8 (2026-08-15). Data as JSON: /api/errors/43ae09969e10dbe5. Report an issue: GitHub.