nodejs/node · critical · Error

not implemented

Error message

not implemented

What it means

Generic Error('not implemented') thrown by the abstract Dispatcher.dispatch() base method. The base Dispatcher class (dispatcher.js) is an abstract superclass; dispatch() must be overridden by a concrete subclass (DispatcherBase, Client, Pool, Agent). Instantiating the base Dispatcher directly, or subclassing it without overriding dispatch(), produces this on the first call.

Source

Thrown at deps/undici/src/lib/dispatcher/dispatcher.js:6

'use strict'
const EventEmitter = require('node:events')

class Dispatcher extends EventEmitter {
  dispatch () {
    throw new Error('not implemented')
  }

  close () {
    throw new Error('not implemented')
  }

  destroy () {
    throw new Error('not implemented')
  }

  compose (...args) {
    // So we handle [interceptor1, interceptor2] or interceptor1, interceptor2, ...
    const interceptors = Array.isArray(args[0]) ? args[0] : args
    let dispatch = this.dispatch.bind(this)

    for (const interceptor of interceptors) {
      if (interceptor == null) {
        continue

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Use a concrete dispatcher: Client, Pool, Agent, or BalancedPool.
  2. If subclassing, extend DispatcherBase (which provides dispatch/close/destroy plumbing) or implement dispatch() yourself.
  3. For custom dispatch logic, use compose(interceptors) on a real dispatcher instead of subclassing the base.

Example fix

// before
const Dispatcher = require('undici/lib/dispatcher/dispatcher')
const d = new Dispatcher()
d.dispatch(opts, handler) // throws
// after
const { Client } = require('undici')
const client = new Client(url)
client.dispatch(opts, handler)
Defensive patterns

Strategy: validation

Validate before calling

function isConcreteDispatcher(d) {
  return !!d && typeof d.dispatch === 'function' && d.dispatch !== require('undici/lib/dispatcher/dispatcher').prototype.dispatch;
}

Type guard

dispatcher instanceof DispatcherBase

Prevention

When it happens

Trigger: Calling `dispatch()` on a `new Dispatcher()` instance, or on a custom subclass of Dispatcher (not DispatcherBase) that does not override dispatch(). Fires at dispatcher.js:5-6.

Common situations: Directly requiring and instantiating the base Dispatcher class; writing a custom interceptor/agent that extends Dispatcher instead of DispatcherBase and forgets to implement dispatch; mock/stub objects that extend the base for typing.

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/8e60ac57846a0a7e. Report an issue: GitHub.