ethereum/go-ethereum · error · Error

Filter ID Error: filter().get() can't be chained synchronous

Error message

Filter ID Error: filter().get() can't be chained synchronous, please provide a callback for the get() method.

What it means

inputAddressFormatter normalizes an address argument before it is sent to RPC. It accepts a valid direct IBAN (converted to 0x address), a strict 0x-prefixed 20-byte hex address, or a bare 40-hex-char address (0x added). Anything else — wrong length, non-hex characters, bad checksums that make it neither form — throws 'invalid address'.

Source

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

    if (utils.isFunction(callback)) {
        if (this.filterId === null) {
            // If filterId is not set yet, call it back
            // when newFilter() assigns it.
            this.getLogsCallbacks.push(callback);
        } else {
            this.implementation.getLogs(this.filterId, function(err, res){
                if (err) {
                    callback(err);
                } else {
                    callback(null, res.map(function (log) {
                        return self.formatter ? self.formatter(log) : log;
                    }));
                }
            });
        }
    } else {
        if (this.filterId === null) {
            throw new Error('Filter ID Error: filter().get() can\'t be chained synchronous, please provide a callback for the get() method.');
        }
        var logs = this.implementation.getLogs(this.filterId);
        return logs.map(function (log) {
            return self.formatter ? self.formatter(log) : log;
        });
    }

    return this;
};

module.exports = Filter;


},{"../utils/utils":20,"./formatters":30}],30:[function(require,module,exports){
'use strict'

/*
    This file is part of web3.js.

View on GitHub (pinned to 6bb0588ad8)

Solutions

  1. Print/inspect the exact value passed and compare length: must be 40 hex chars, optionally 0x-prefixed.
  2. Fix the source of the address (config typo, truncation, encoding).
  3. Validate with web3.isAddress(addr) before calling the API.
  4. If using ICAP, ensure it is a direct IBAN or resolve it to an address first.

Example fix

// before
eth.sendTransaction({from: a, to: '0x' + shortHex39chars, value: 1});

// after
if (!web3.isAddress(to)) throw 'bad address';
eth.sendTransaction({from: a, to: to, value: 1});
Defensive patterns

Strategy: type-guard

Validate before calling

function normalizeAddress(a) {
  if (typeof a !== 'string') throw new Error('address must be a string');
  a = a.trim();
  if (/^0x[0-9a-fA-F]{40}$/.test(a)) return a;
  if (/^[0-9a-fA-F]{40}$/.test(a)) return '0x' + a;
  throw new Error('invalid address: ' + a);
}

Type guard

function isSendableAddress(a) {
  return typeof a === 'string' && web3.isAddress(a.trim());
}

Try / catch

try { eth.getBalance(addr); }
catch (e) {
  if (e.message === 'invalid address') { /* log offending addr, fix source */ }
  else throw e;
}

Prevention

When it happens

Trigger: Calling any address-taking web3 method (sendTransaction to, getBalance, contract methods with address params) with a malformed string: 39 or 41 hex chars, unquoted hex treated as a number, missing 0x with odd characters, empty string, or an ICAP string that is not direct/valid.

Common situations: Copying an address with a truncated character, passing undefined/null variable, string concatenation errors ('0x' + addr where addr already had 0x is fine but double prefixes are not), or passing an ENS-like name where a raw address is required in this old web3 version.

Related errors


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