{"record":{"id":"e83d2bb78980de95","repo":"zloirock/core-js","slug":"transfer-option-cannot-be-converted-to-a-sequence","errorCode":null,"errorMessage":"Transfer option cannot be converted to a sequence","messagePattern":"Transfer option cannot be converted to a sequence","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/core-js/modules/web.structured-clone.js","lineNumber":431,"sourceCode":"        createNonEnumerableProperty(cloned, 'cause', structuredCloneInternal(value.cause, map));\n      }\n      if (name === 'AggregateError') {\n        cloned.errors = structuredCloneInternal(value.errors, map);\n      } else if (name === 'SuppressedError') {\n        cloned.error = structuredCloneInternal(value.error, map);\n        cloned.suppressed = structuredCloneInternal(value.suppressed, map);\n      } // break omitted\n    case 'DOMException':\n      if (ERROR_STACK_INSTALLABLE) {\n        createNonEnumerableProperty(cloned, 'stack', structuredCloneInternal(value.stack, map));\n      }\n  }\n\n  return cloned;\n};\n\nvar tryToTransfer = function (rawTransfer, map) {\n  if (!isObject(rawTransfer)) throw new TypeError('Transfer option cannot be converted to a sequence');\n\n  var transfer = [];\n\n  iterate(rawTransfer, function (value) {\n    push(transfer, anObject(value));\n  });\n\n  var i = 0;\n  var length = lengthOfArrayLike(transfer);\n  var buffers = new Set();\n  var value, type, C, transferred, canvas, context;\n\n  while (i < length) {\n    value = transfer[i++];\n    type = classof(value);\n    transferred = undefined;\n\n    if (type === 'ArrayBuffer' ? setHas(buffers, value) : mapHas(map, value)) {","sourceCodeStart":413,"sourceCodeEnd":449,"githubUrl":"https://github.com/zloirock/core-js/blob/84e45fba098dd3a177d5cf2247d06ab8e98d3790/packages/core-js/modules/web.structured-clone.js#L413-L449","documentation":"TypeError thrown by tryToTransfer in the core-js structuredClone polyfill when the transfer option passed to structuredClone(value, { transfer }) is not an object that can be iterated as a sequence (per WebIDL it must be a sequence of transferable objects). Anything non-object — a string, number, null-ish wrapped value — fails the isObject check.","triggerScenarios":"structuredClone(value, { transfer: 'abc' }) or { transfer: 42 } — a non-object transfer option; per spec a string is actually iterable, but the polyfill's isObject check rejects it with this TypeError before iterating.","commonSituations":"Dynamically building options and accidentally passing a single transferable instead of an array (transfer: buf instead of [buf]) combined with a primitive; typos like transfer: null; confused option shapes from older call sites.","solutions":["Always pass an array of transferable objects: { transfer: [buffer] }","Wrap single transferables in an array before calling","Validate the option is an array/object before invoking structuredClone"],"exampleFix":"// before\nstructuredClone(state, { transfer: buf }); // TypeError: Transfer option cannot be converted to a sequence\n// after\nstructuredClone(state, { transfer: [buf] });","handlingStrategy":"validation","validationCode":"function buildOptions(transfer) {\n  if (transfer != null && !Array.isArray(transfer) && (typeof transfer !== 'object' || typeof transfer[Symbol.iterator] !== 'function')) {\n    transfer = [transfer];\n  }\n  return { transfer };\n}","typeGuard":"const isTransferSequence = (t) =>\n  t != null && typeof t === 'object' && (Array.isArray(t) || typeof t[Symbol.iterator] === 'function');","tryCatchPattern":"try {\n  return structuredClone(v, opts);\n} catch (e) {\n  if (e instanceof TypeError && /Transfer option cannot be converted/.test(e.message)) {\n    return structuredClone(v, { transfer: [opts.transfer].flat().filter(Boolean) });\n  }\n  throw e;\n}","preventionTips":["Always pass an array as the transfer option","Wrap single transferables: transfer: [buf]","Validate option shapes when building them dynamically","Never pass null/undefined/strings as transfer"],"tags":["structured-clone","transfer","typeerror","options"],"backgroundTag":"invalid-transfer-option","analyzedSha":"84e45fba098dd3a177d5cf2247d06ab8e98d3790","analyzedAt":"2026-08-30T20:36:10.323Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}