{"record":{"id":"6de894d32b15f2ac","repo":"denoland/deno","slug":"failed-to-initialize-v8-platform-could-not-start","errorCode":null,"errorMessage":"Failed to initialize V8 platform (could not start worker threads). If running in a container, ensure the PID limit is high enough (try --pids-limit=40 or higher).","messagePattern":"Failed to initialize V8 platform \\(could not start worker threads\\)\\. If running in a container, ensure the PID limit is high enough \\(try --pids-limit=40 or higher\\)\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"cli/lib.rs","lineNumber":701,"sourceCode":"      eprintln!(\n        \"https://panic.deno.com/v{}/{}/{}\",\n        version,\n        env!(\"TARGET\"),\n        trace\n      );\n    }\n\n    orig_hook(panic_info);\n    deno_runtime::exit(1);\n  }));\n\n  fn error_handler(file: &str, line: i32, message: &str) {\n    // Provide a clearer message for thread creation failures, which\n    // typically happen when running in containers with low PID limits\n    // (e.g. Docker --pids-limit). V8's default error is just\n    // \"Check failed: Start()\" which is unhelpful.\n    if message.contains(\"Check failed: Start()\") {\n      panic!(\n        \"Failed to initialize V8 platform (could not start worker threads). \\\n        If running in a container, ensure the PID limit is high enough \\\n        (try --pids-limit=40 or higher).\"\n      );\n    }\n    // Override C++ abort with a rust panic, so we\n    // get our message above and a nice backtrace.\n    panic!(\"Fatal error in {file}:{line}: {message}\");\n  }\n\n  deno_core::v8::V8::set_fatal_error_handler(error_handler);\n}\n\n/// Returns `true` if `panic_info` is a panic from `std`'s print macros caused\n/// by the downstream reader of stdout/stderr closing the pipe.\n///\n/// `println!`/`print!`/`eprintln!`/`eprint!` panic with the literal payload\n/// `\"failed printing to {stdout,stderr}: <io error>\"` when the underlying","sourceCodeStart":683,"sourceCodeEnd":719,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/lib.rs#L683-L719","documentation":"Runtime panic from the V8 fatal-error handler installed in cli/lib.rs. When V8 tries to create its platform worker threads and the OS refuses (EAGAIN due to thread/PID limits), V8 reports \"Check failed: Start()\". Deno detects that message and re-panics with an actionable hint about container PID limits, because V8's raw message is unhelpful.","triggerScenarios":"Starting any deno process (run, repl, test) in a container or namespace where the thread/PID budget is exhausted: Docker `--pids-limit` too low, cgroup pids.max reached, ulimit -u exceeded, or many workers already spawned so V8's platform threads cannot be created.","commonSituations":"Docker/Kubernetes with default-low pids limits (e.g. --pids-limit=10); CI sandboxes; rootless Podman with narrow user namespaces; parallel test matrices spawning many deno processes on one host.","solutions":["Raise the container PID limit: docker run --pids-limit=40 (or higher) / raise the pids cgroup limit in Kubernetes","Raise the user thread limit: `ulimit -u 4096` (or tune /etc/security/limits.conf)","Reduce concurrent deno processes/parallel test shards, or run with the single-threaded V8 platform (`--single-threaded`) if applicable"],"exampleFix":"# before\ndocker run --pids-limit=10 denoland/deno deno run app.ts\n# after\ndocker run --pids-limit=40 denoland/deno deno run app.ts","handlingStrategy":"validation","validationCode":"# preflight inside the container before launching deno\nulimit -u || true\nmax=$(cat /sys/fs/cgroup/pids.max 2>/dev/null || echo max)\ncur=$(cat /sys/fs/cgroup/pids.current 2>/dev/null || echo 0)\n[ \"$max\" = \"max\" ] || [ \"$cur\" -lt \"$max\" ] || { echo 'pid budget exhausted; raise pids limit'; exit 2; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run deno containers with --pids-limit of at least 40 (more when running tests/workers)","Cap test parallelism (--parallel/-j) to keep total deno threads under the cgroup limit","Try the --single-threaded flag in constrained environments"],"tags":["v8","threads","container","pids-limit","cgroup","startup-crash"],"backgroundTag":"thread-creation-failed","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}