{"record":{"id":"5b9c69acec53d374","repo":"avajs/ava","slug":"missing-default-factory-function-export-for-shared","errorCode":null,"errorMessage":"Missing default factory function export for shared worker plugin at ${workerData.filename}","messagePattern":"Missing default factory function export for shared worker plugin at (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"lib/plugin-support/shared-worker-loader.js","lineNumber":172,"sourceCode":"\t\t},\n\t};\n}\n\nasync function loadFactory() {\n\tconst {default: factory} = await import(workerData.filename);\n\treturn factory;\n}\n\nlet signalAvailable = () => {\n\tparentPort.postMessage({type: 'available'});\n\tsignalAvailable = () => {};\n};\n\nlet fatal;\ntry {\n\tconst factory = await loadFactory(workerData.filename);\n\tif (typeof factory !== 'function') {\n\t\tthrow new TypeError(`Missing default factory function export for shared worker plugin at ${workerData.filename}`);\n\t}\n\n\tfactory({\n\t\tnegotiateProtocol(supported) {\n\t\t\tif (!supported.includes('ava-4')) {\n\t\t\t\tfatal = new Error(`This version of AVA (${pkg.version}) is not compatible with shared worker plugin at ${workerData.filename}`);\n\t\t\t\tthrow fatal;\n\t\t\t}\n\n\t\t\tconst produceTestWorker = instance => events.emit('testWorker', instance);\n\n\t\t\tparentPort.on('message', async message => {\n\t\t\t\tif (message.type === 'register-test-worker') {\n\t\t\t\t\tconst {id, file, port} = message;\n\t\t\t\t\tconst instance = new TestWorker(id, file, port);\n\n\t\t\t\t\tactiveTestWorkers.set(id, {instance, teardownFns: new Set()});\n","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/plugin-support/shared-worker-loader.js#L154-L190","documentation":"In the shared worker loader's startup, dynamic import of the plugin module succeeded but its default export is not a function. Shared worker plugins must export a default factory that receives {negotiateProtocol}; a default object, class, or missing export triggers this TypeError. The input at fault is the module at workerData.filename.","triggerScenarios":"Thrown at lib/plugin-support/shared-worker-loader.js:172 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add export default function (ava) { ... } to the plugin module","Ensure build tooling (Babel/tsup) does not replace the default export with an object of named exports","Check the resolved filename points at the compiled entry, not a source stub"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bbfd946322fdeca2b547a691d947fb4e18c0c67f","analyzedAt":"2026-09-02T01:24:43.834Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}