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

  1. Install the target package: npm install pino-pretty (or the custom transport module)
  2. Fix the target string/path typo or verify the referenced file exists
  3. 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

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


AI-assisted analysis of pinojs/pino@5aa62305c5 (2026-09-02). Data as JSON: /api/errors/b68938e0025c1851. Report an issue: GitHub.