{"record":{"id":"d13e6652d233f981","repo":"firecracker-microvm/firecracker","slug":"api-thread-spawn-failed","errorCode":null,"errorMessage":"API thread spawn failed.","messagePattern":"API thread spawn failed\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/firecracker/src/api_server_adapter.rs","lineNumber":214,"sourceCode":"        .try_clone()\n        .expect(\"Failed to clone API kill switch\");\n\n    server\n        .add_kill_switch(api_kill_switch_clone)\n        .expect(\"Cannot add HTTP server kill switch\");\n\n    // Start the separate API thread.\n    let api_thread = thread::Builder::new()\n        .name(\"fc_api\".to_owned())\n        .spawn(move || {\n            ApiServer::new(to_vmm, from_vmm, to_vmm_event_fd).run(\n                server,\n                process_time_reporter,\n                &api_seccomp_filter,\n                api_payload_limit,\n            );\n        })\n        .expect(\"API thread spawn failed.\");\n\n    let mut event_manager = EventManager::new().expect(\"Unable to create EventManager\");\n\n    // Create the firecracker metrics object responsible for periodically printing metrics.\n    let firecracker_metrics = Arc::new(Mutex::new(super::metrics::PeriodicMetrics::new()));\n    event_manager.add_subscriber(firecracker_metrics.clone());\n\n    // Configure, build and start the microVM.\n    let build_result = match config_json {\n        Some(json) => super::build_microvm_from_json(\n            seccomp_filters,\n            &mut event_manager,\n            json,\n            instance_info,\n            boot_timer_enabled,\n            pci_enabled,\n            mmds_size_limit,\n            metadata_json,","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/firecracker-microvm/firecracker/blob/0a745def42ddf4cc2a744d79a08a27ff50b5d27a/src/firecracker/src/api_server_adapter.rs#L196-L232","documentation":"Error \"API thread spawn failed.\" thrown in firecracker-microvm/firecracker.","triggerScenarios":"Thrown at src/firecracker/src/api_server_adapter.rs:214 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check system thread limits (ulimit -u, cgroup pids.max) and available memory; thread spawn fails on resource exhaustion.","Inspect the OS error from the failed spawn for the precise cause."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0a745def42ddf4cc2a744d79a08a27ff50b5d27a","analyzedAt":"2026-08-19T05:27:02.517Z","contentChangedAt":"2026-08-19T05:27:02.517Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}