{"record":{"id":"b68938e0025c1851","repo":"pinojs/pino","slug":"unable-to-determine-transport-target-for-origin","errorCode":null,"errorMessage":"unable to determine transport target for \"${origin}\"","messagePattern":"unable to determine transport target for \"(.+?)\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/transport.js","lineNumber":295,"sourceCode":"\n    let fixTarget\n\n    for (const filePath of callers) {\n      try {\n        const context = filePath === 'node:repl'\n          ? process.cwd() + sep\n          : filePath\n\n        fixTarget = createRequire(context).resolve(origin)\n        break\n      } catch (err) {\n        // Silent catch\n        continue\n      }\n    }\n\n    if (!fixTarget) {\n      throw new Error(`unable to determine transport target for \"${origin}\"`)\n    }\n\n    return fixTarget\n  }\n}\n\nmodule.exports = transport\n","sourceCodeStart":277,"sourceCodeEnd":303,"githubUrl":"https://github.com/pinojs/pino/blob/5aa62305c57709ebd6f6b7c328e8830eeb29b297/lib/transport.js#L277-L303","documentation":"fixTarget (lib/transport.js:295) resolves a transport target string to an absolute module path. When the origin (target module name) cannot be resolved — module not installed, not a valid file path, and no bundler path override exists — it throws this error.","triggerScenarios":"transport: { target: 'pino-pretty' } when pino-pretty is not installed; a relative path that doesn't exist; custom target names without a registered __bundlerPathsOverrides entry in bundled builds.","commonSituations":"Forgetting to npm install pino-pretty or a custom transport; typos in the target module name; bundling with webpack/esbuild where dynamic require resolution fails and no bundler override is set.","solutions":["Install the target package: npm install pino-pretty (or the custom transport module)","Fix the target string/path typo or verify the referenced file exists","In bundled environments, set globalThis.__bundlerPathsOverrides to map the target name to its bundled path"],"exampleFix":"// before (pino-pretty not installed)\nconst logger = pino({ transport: { target: 'pino-pretty' } });\n// after\n// npm install pino-pretty\nconst logger = pino({ transport: { target: 'pino-pretty' } });","handlingStrategy":"validation","validationCode":"function assertTransportResolvable(target) {\n  if (typeof target === 'string' && !/^\\.?\\.?\\//.test(target)) {\n    // third-party module: it must be installed\n    // fail fast at startup\n  }\n}","typeGuard":"function isModuleTarget(t) { return typeof t === 'string' && !t.startsWith('.') && !t.startsWith('/'); }","tryCatchPattern":"try { logger = pino({ transport: { target } }); } catch (e) { if (/unable to determine transport target/.test(e.message)) { console.error(`Transport '${target}' not found; install it or fix the path`); } throw e; }","preventionTips":["Add transport packages (pino-pretty, pino/file, etc.) to dependencies, not devDependencies, if used at runtime","Resolve target paths with require.resolve at startup to fail fast","In bundles, configure globalThis.__bundlerPathsOverrides for every transport"],"tags":["logging","pino","transport","module-resolution"],"backgroundTag":"module-not-found","analyzedSha":"5aa62305c57709ebd6f6b7c328e8830eeb29b297","analyzedAt":"2026-09-02T22:05:21.418Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}