{"record":{"id":"0411fc88eddf44a5","repo":"denoland/deno","slug":"err-invalid-sync-fork-input","errorCode":"ERR_INVALID_SYNC_FORK_INPUT","errorMessage":"Asynchronous forks do not support Buffer, TypedArray, DataView or string input: ${value}","messagePattern":"Asynchronous forks do not support Buffer, TypedArray, DataView or string input: (.+?)","errorType":"validation","errorClass":"NodeTypeError","httpStatus":null,"severity":"error","filePath":"ext/node/polyfills/internal/child_process.ts","lineNumber":1161,"sourceCode":"      if (sync) {\n        throw new ERR_IPC_SYNC_FORK();\n      }\n      ipc = i;\n      ipcFd = i;\n      ArrayPrototypePush(result, { type: \"ipc\" });\n    } else if (value === \"ignore\" || value === null) {\n      ArrayPrototypePush(result, { type: \"ignore\" });\n    } else if (value === \"pipe\" || value === undefined) {\n      ArrayPrototypePush(result, { type: \"pipe\" });\n    } else if (value === \"inherit\") {\n      ArrayPrototypePush(result, { type: \"inherit\" });\n    } else if (value === \"overlapped\") {\n      ArrayPrototypePush(result, { type: \"overlapped\" });\n    } else if (typeof value === \"number\") {\n      ArrayPrototypePush(result, { type: \"fd\", fd: value });\n    } else if (typeof value === \"string\") {\n      // Invalid string value\n      throw new ERR_INVALID_SYNC_FORK_INPUT(value);\n    } else if (typeof value === \"object\" && value !== null) {\n      // Check if it's a Stream with fd property (like process.stdin/stdout/stderr)\n      if (\n        value.fd !== undefined && typeof value.fd === \"number\"\n      ) {\n        ArrayPrototypePush(result, { type: \"fd\", fd: value.fd });\n      } else if (ObjectPrototypeIsPrototypeOf(Stream.prototype, value)) {\n        // Valid Stream object but without fd\n        ArrayPrototypePush(result, { type: \"pipe\" });\n      } else {\n        // Invalid object\n        throw new ERR_INVALID_ARG_VALUE(\"stdio\", value);\n      }\n    } else {\n      throw new ERR_INVALID_ARG_VALUE(\"stdio\", value);\n    }\n  }\n","sourceCodeStart":1143,"sourceCodeEnd":1179,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/ext/node/polyfills/internal/child_process.ts#L1143-L1179","documentation":"While iterating stdio array elements, getValidStdio() recognizes the keywords ('ipc', 'ignore', null, 'pipe', undefined, 'inherit', 'overlapped'), numbers (fds), and objects (fd-holders or Streams). A string element that is not one of those keywords falls into the string branch and throws ERR_INVALID_SYNC_FORK_INPUT, whose message ('Asynchronous forks do not support Buffer, TypedArray, DataView or string input') is inherited verbatim from Node and refers to this class of invalid stdio input values.","triggerScenarios":"stdio: ['silent', 'pipe', 'pipe']; ['null', 'inherit']; ['ipc2', 'pipe']; strings from config or template literals ('${mode}' resolving to an unknown word).","commonSituations":"Feature-flag strings ('silent', 'null', 'shared') copied from another library's vocabulary; interpolated stdio values that end up empty ('') or with whitespace; docs examples that use 'inherit-all' pseudo-values.","solutions":["Map custom vocabulary to real keywords before spawn: silent->'ignore', null->'ignore', inheritAll->'inherit'","Whitelist-check every string element: ['pipe','inherit','ignore','overlapped','ipc']","Trim interpolated values and fall back to 'pipe' for empties"],"exampleFix":"// before\nconst mode = cfg.quiet ? 'silent' : 'pipe';\nspawnSync(cmd, args, { stdio: [mode, 'pipe', 'pipe'] });\n\n// after\nconst mode = cfg.quiet ? 'ignore' : 'pipe';\nspawnSync(cmd, args, { stdio: [mode, 'pipe', 'pipe'] });","handlingStrategy":"type-guard","validationCode":"const KEYWORDS = new Set(['pipe', 'inherit', 'ignore', 'overlapped', 'ipc']);\nconst ALIASES = { silent: 'ignore', quiet: 'ignore', null: 'ignore', none: 'ignore', tty: 'inherit' };\nfunction normalizeEntry(e) {\n  if (typeof e === 'string') {\n    const t = e.trim();\n    if (KEYWORDS.has(t)) return t;\n    if (t in ALIASES) return ALIASES[t];\n    throw new Error(`invalid stdio entry '${e}'`);\n  }\n  return e;\n}","typeGuard":"const isValidStdioKeyword = (s) =>\n  ['pipe', 'inherit', 'ignore', 'overlapped', 'ipc'].includes(s);","tryCatchPattern":"try { spawnSync(cmd, { stdio }); } catch (err) {\n  if (err?.code === 'ERR_INVALID_SYNC_FORK_INPUT' ||\n      (err?.code === 'ERR_INVALID_ARG_VALUE' && /stdio/.test(err.message))) {\n    spawnSync(cmd, { stdio: stdio.map((e) => (typeof e === 'string' && isValidStdioKeyword(e)) ? e : 'pipe') });\n  }\n}","preventionTips":["Translate library-specific words (silent, null, none) to real keywords before spawning","Trim interpolated strings; empty strings are never valid stdio entries","Centralize a normalizeStdio() helper so every spawn site uses the same vocabulary"],"tags":["child-process","stdio","spawn-sync","node-compat","deno"],"backgroundTag":"invalid-stdio-option","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}