{"record":{"id":"934f5edf08f3e3e3","repo":"ethereum/go-ethereum","slug":"invalid-iban-address","errorCode":null,"errorMessage":"invalid iban address","messagePattern":"invalid iban address","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"internal/jsre/deps/web3.js","lineNumber":6370,"sourceCode":" * @date 2015\n */\n\nvar Iban = require('./iban');\nvar exchangeAbi = require('../contracts/SmartExchange.json');\n\n/**\n * Should be used to make Iban transfer\n *\n * @method transfer\n * @param {String} from\n * @param {String} to iban\n * @param {Value} value to be transferred\n * @param {Function} callback, callback\n */\nvar transfer = function (eth, from, to, value, callback) {\n    var iban = new Iban(to); \n    if (!iban.isValid()) {\n        throw new Error('invalid iban address');\n    }\n\n    if (iban.isDirect()) {\n        return transferToAddress(eth, from, iban.address(), value, callback);\n    }\n    \n    if (!callback) {\n        var address = eth.icapNamereg().addr(iban.institution());\n        return deposit(eth, from, address, value, iban.client());\n    }\n\n    eth.icapNamereg().addr(iban.institution(), function (err, address) {\n        return deposit(eth, from, address, value, iban.client(), callback);\n    });\n    \n};\n\n/**","sourceCodeStart":6352,"sourceCodeEnd":6388,"githubUrl":"https://github.com/ethereum/go-ethereum/blob/6bb0588ad8e7f922e4ad5580f51265a4097af08f/internal/jsre/deps/web3.js#L6352-L6388","documentation":"Iban.transfer converts the recipient 'to' argument to an Iban object and validates it with iban.isValid() (mod-97 checksum + format). If the string is not a well-formed IBAN, it throws 'invalid iban address' before constructing any transaction.","triggerScenarios":"Calling Iban.transfer(eth, from, to, value[, callback]) with a malformed ICAP/IBAN string: wrong country code length, bad checksum digits, invalid institution/character layout. The synchronous no-callback path validates first and throws.","commonSituations":"Hand-typing an ICAP address (XE81ETHXREGGAVOFYORK style) with a checksum error, passing an 0x address where an IBAN was expected, or trailing whitespace/case issues corrupting the checksum.","solutions":["Use Iban.fromAddress('0x...') or Iban.createIndirect(...) to generate a checksummed IBAN instead of hand-writing it.","Validate first: new web3.eth.Iban(str).isValid() before calling transfer.","If the recipient is a plain address, use eth.sendTransaction to the 0x address rather than Iban.transfer.","Re-derive the checksum: recreate the IBAN with Iban tools or a checksum calculator."],"exampleFix":"// before\nIban.transfer(eth, from, 'XE81ETHXREGGAVOFYORKx', value); // bad checksum\n\n// after\nvar iban = new web3.eth.Iban('XE81ETHXREGGAVOFYORK');\nif (iban.isValid()) Iban.transfer(eth, from, iban.toString(), value);","handlingStrategy":"type-guard","validationCode":"var Iban = require('web3/lib/web3/iban'); // or web3.eth.Iban\nfunction safeIbanTransfer(eth, from, to, value, cb) {\n  var iban = new Iban(to);\n  if (!iban.isValid()) throw new Error('not a valid IBAN: ' + to);\n  return Iban.transfer(eth, from, to, value, cb);\n}","typeGuard":"function isValidIban(s) {\n  try { return new web3.eth.Iban(s).isValid(); } catch (e) { return false; }\n}","tryCatchPattern":null,"preventionTips":["Construct IBANs programmatically (Iban.fromAddress) rather than hand-typing.","Run isValid() on user-supplied IBANs at the boundary."],"tags":["web3","iban","icap","input-validation"],"backgroundTag":null,"analyzedSha":"6bb0588ad8e7f922e4ad5580f51265a4097af08f","analyzedAt":"2026-08-15T10:06:53.996Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}