denoland/deno · error · Error

ERR_NOT_IMPLEMENTED

ERR_NOT_IMPLEMENTED

Error message

Not implemented: ${msg}

What it means

Deno's ext/node polyfills stub out Node APIs that are not yet implemented using notImplemented(msg), which throws ERR_NOT_IMPLEMENTED naming the missing feature (the message is `Not implemented: ${msg}`). The module still imports successfully and the API surface exists, so the failure surfaces at call time rather than load time — Deno's standard signal that a node: API is recognized but not built yet.

Solutions

  1. Read the message to identify the exact unimplemented API and check for a standard-web or Deno-native equivalent
  2. Update Deno — ext/node coverage grows every release and the call may now work
  3. Isolate the feature behind an interface so Deno uses an alternative implementation or run that path on Node
  4. Feature-detect and fall back: wrap the call and degrade gracefully when it throws ERR_NOT_IMPLEMENTED

Example fix

// before
import diagnostics_channel from 'node:diagnostics_channel';
diagnostics_channel.subscribe('http', handler); // may throw ERR_NOT_IMPLEMENTED in Deno

// after
import diagnostics_channel from 'node:diagnostics_channel';
try {
  diagnostics_channel.subscribe('http', handler);
} catch (err) {
  if ((err as NodeJS.ErrnoException).code === 'ERR_NOT_IMPLEMENTED') {
    // fallback tracing, e.g. a no-op collector
  } else throw err;
}
Defensive patterns

Strategy: fallback

Validate before calling

function callIfImplemented<T extends (...args: never[]) => unknown>(
  fn: T | undefined,
  ...args: Parameters<T>
): void {
  try {
    fn?.(...args);
  } catch (err) {
    if ((err as NodeJS.ErrnoException).code !== 'ERR_NOT_IMPLEMENTED') throw err;
  }
}

Try / catch

try {
  result = nodeApi(input);
} catch (err) {
  if ((err as NodeJS.ErrnoException).code === 'ERR_NOT_IMPLEMENTED') {
    result = webOrDenoAlternative(input); // standard-web or Deno-native equivalent
  } else throw err;
}

Prevention

When it happens

Trigger: Calling any polyfilled-but-stubbed node: API from Deno's ext/node — the message names the exact feature; typically little-used corners of node:crypto, process internals, or modules npm packages reach indirectly.

Common situations: Running npm packages under Deno that exercise Node internals not yet covered; code that works on Node failing at one specific call on Deno; upgrading or downgrading Deno changing coverage.

Related errors


AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20). Data as JSON: /api/errors/9f67f81c11c205d6. Report an issue: GitHub.

Appendix: source

Thrown at ext/node/polyfills/_utils.ts:46

type BinaryEncodings = "binary";

type TextEncodings =
  | "ascii"
  | "utf8"
  | "utf-8"
  | "utf16le"
  | "ucs2"
  | "ucs-2"
  | "base64"
  | "base64url"
  | "latin1"
  | "hex";

type Encodings = BinaryEncodings | TextEncodings;

function notImplemented(msg: string): never {
  throw new ERR_NOT_IMPLEMENTED(msg);
}

function warnNotImplemented(msg?: string) {
  const message = msg
    ? `Warning: Not implemented: ${msg}`
    : "Warning: Not implemented";
  // deno-lint-ignore no-console
  console.warn(message);
}

type _TextDecoder = typeof TextDecoder.prototype;
const _TextDecoder = TextDecoder;

type _TextEncoder = typeof TextEncoder.prototype;
const _TextEncoder = TextEncoder;

// API helpers

View on GitHub (pinned to 9ad36f7a2c)