pinojs/pino · error · Error
unable to determine transport target for "${origin}"
Error message
unable to determine transport target for "${origin}" What it means
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.
Source
Thrown at lib/transport.js:295
let fixTarget
for (const filePath of callers) {
try {
const context = filePath === 'node:repl'
? process.cwd() + sep
: filePath
fixTarget = createRequire(context).resolve(origin)
break
} catch (err) {
// Silent catch
continue
}
}
if (!fixTarget) {
throw new Error(`unable to determine transport target for "${origin}"`)
}
return fixTarget
}
}
module.exports = transport
View on GitHub (pinned to 5aa62305c5)
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
Example fix
// before (pino-pretty not installed)
const logger = pino({ transport: { target: 'pino-pretty' } });
// after
// npm install pino-pretty
const logger = pino({ transport: { target: 'pino-pretty' } }); Defensive patterns
Strategy: validation
Validate before calling
function assertTransportResolvable(target) {
if (typeof target === 'string' && !/^\.?\.?\//.test(target)) {
// third-party module: it must be installed
// fail fast at startup
}
} Type guard
function isModuleTarget(t) { return typeof t === 'string' && !t.startsWith('.') && !t.startsWith('/'); } Try / catch
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; } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- only one of target or targets can be specified
- PINO_TRANSPORT_MULTI_TARGETS_LEVEL_FORMATTER
- missing bindings for child Pino
- Levels comparison should be one of "ASC", "DESC" or "functio
- prettyPrint option is no longer supported, see the pino-pret
AI-assisted analysis of pinojs/pino@5aa62305c5 (2026-09-02).
Data as JSON: /api/errors/b68938e0025c1851.
Report an issue: GitHub.