denoland/deno · error · Error

ERR_NOT_IMPLEMENTED

ERR_NOT_IMPLEMENTED

Error message

Not implemented: ${msg}

What it means

This is Deno's node-compatibility shim for APIs that exist in Node but have no Deno implementation (ext/node/polyfills/_utils.ts:46). notImplemented(msg) throws ERR_NOT_IMPLEMENTED with a message naming the exact API. In this repo the live call sites include tls.createSecurePair, vm.measureMemory, v8.stopCoverage/takeCoverage, crypto.setEngine, crypto.secureHeapUsed, worker_threads getHeapSnapshot/parentPort.emit/removeAllListeners, fs.readlink with buffer encodings, ChildProcess.send with non-TCP handles, and cares setLocalAddress.

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 89f33cbef2)

Solutions

  1. Replace the legacy call with the modern equivalent — tls.TLSSocket/tls.connect instead of createSecurePair; cluster/IPC alternatives instead of child.send with handles
  2. Feature-detect and degrade gracefully: if (typeof fn === 'function') { try { fn(); } catch (e) { if (e.code === 'ERR_NOT_IMPLEMENTED') fallback(); } }
  3. Run that code path under Node.js if the unimplemented API is essential to the library

Example fix

// before
const pair = tls.createSecurePair(credentials, false, false, false);

// after
const socket = tls.connect({ socket: rawSocket, ...credentials, isServer: false });
Defensive patterns

Strategy: try-catch

Validate before calling

const supported = (() => { try { tls.createSecurePair; return true; } catch { return false; } })();

Try / catch

try { vm.measureMemory(); } catch (e) { if (e.code === 'ERR_NOT_IMPLEMENTED') { /* degrade: skip measurement */ } else throw e; }

Prevention

When it happens

Trigger: Calling tls.createSecurePair() (legacy API, removed in Node 12 but still shimmed); vm.measureMemory(); v8.takeCoverage(); crypto.setEngine(...); parentPort.emit(...) in worker_threads; child.send(data, udpSocket) with a non-TCP handle; fs.readlink(path, { encoding: 'buffer' }).

Common situations: Running older libraries that predate modern TLS APIs (createSecurePair); coverage tooling that drives v8 coverage APIs; IPC code that ships sockets between processes; migration of Node tools to Deno hitting gaps in the compat layer.

Related errors


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