{"record":{"id":"af91e3a0d29070b0","repo":"denoland/deno","slug":"invalid-serialization-type","errorCode":null,"errorMessage":"Invalid serialization type: {}","messagePattern":"Invalid serialization type: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ext/node/ops/ipc.rs","lineNumber":17,"sourceCode":"// Copyright 2018-2026 the Deno authors. MIT license.\n\npub use impl_::*;\n\n#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]\npub enum ChildIpcSerialization {\n  Json,\n  Advanced,\n}\n\nimpl std::str::FromStr for ChildIpcSerialization {\n  type Err = deno_core::anyhow::Error;\n  fn from_str(s: &str) -> Result<Self, Self::Err> {\n    match s {\n      \"json\" => Ok(ChildIpcSerialization::Json),\n      \"advanced\" => Ok(ChildIpcSerialization::Advanced),\n      _ => Err(deno_core::anyhow::anyhow!(\n        \"Invalid serialization type: {}\",\n        s\n      )),\n    }\n  }\n}\n\npub struct ChildPipeFd(pub i64, pub ChildIpcSerialization);\n\nmod impl_ {\n  use std::cell::RefCell;\n  use std::future::Future;\n  use std::io;\n  use std::rc::Rc;\n\n  use deno_core::CancelFuture;\n  use deno_core::OpState;\n  use deno_core::RcRef;","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/denoland/deno/blob/89f33cbef296a2b287f323d42de54c871fa69c77/ext/node/ops/ipc.rs#L1-L35","documentation":"At startup Deno reads NODE_CHANNEL_SERIALIZATION_MODE (the env var Node uses for child_process IPC serialization) and parses it with FromStr, which accepts only the exact strings `json` and `advanced`; anything else fails startup with this message. The parse runs whenever the variable is present, even if NODE_CHANNEL_FD is unset.","triggerScenarios":"Launching any `deno` command with NODE_CHANNEL_SERIALIZATION_MODE exported as a value other than json or advanced — different casing (`JSON`), trailing characters, or invented values like `v8`.","commonSituations":"Deno spawned as a child of npm/pnpm script runners or test harnesses that export NODE_CHANNEL_* variables; leftover env exports in a shell profile or Dockerfile from a Node debug session; CI images that pre-set these vars globally.","solutions":["Set NODE_CHANNEL_SERIALIZATION_MODE to exactly `json` or `advanced` (lowercase) in the parent process","Strip the variable when it is not meant for Deno: `env -u NODE_CHANNEL_SERIALIZATION_MODE deno run main.ts`","Audit shell profiles, Dockerfile ENV lines and CI env blocks for stray NODE_CHANNEL_* exports"],"exampleFix":"# before — startup fails: Invalid serialization type: JSON\nNODE_CHANNEL_SERIALIZATION_MODE=JSON deno run main.ts\n\n# after — exact lowercase value\nNODE_CHANNEL_SERIALIZATION_MODE=json deno run main.ts","handlingStrategy":"validation","validationCode":"# validate before invoking deno\ncase \"${NODE_CHANNEL_SERIALIZATION_MODE:-}\" in\n  \"\"|json|advanced) ;;\n  *) echo \"bad NODE_CHANNEL_SERIALIZATION_MODE: '$NODE_CHANNEL_SERIALIZATION_MODE'\"; exit 1;;\nesac\ndeno run main.ts","typeGuard":"fn is_valid_serialization(s: &str) -> bool {\n  matches!(s, \"json\" | \"advanced\")\n}","tryCatchPattern":null,"preventionTips":["Never export NODE_CHANNEL_* globally; scope them to the child spawn that needs them","When spawning Deno children over IPC, pass exactly `json` or `advanced` (lowercase)","In wrappers, strip NODE_CHANNEL_SERIALIZATION_MODE with `env -u` when Deno is not the IPC target"],"tags":["node-compat","ipc","child-process","env-vars","startup"],"backgroundTag":null,"analyzedSha":"89f33cbef296a2b287f323d42de54c871fa69c77","analyzedAt":"2026-08-16T07:54:21.310Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}