{"record":{"id":"53c801120149df7e","repo":"firecracker-microvm/firecracker","slug":"failed-to-clone-api-kill-switch","errorCode":null,"errorMessage":"Failed to clone API kill switch","messagePattern":"Failed to clone API kill switch","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/firecracker/src/api_server_adapter.rs","lineNumber":197,"sourceCode":"    let api_seccomp_filter = seccomp_filters\n        .remove(\"api\")\n        .expect(\"Missing seccomp filter for API thread.\");\n\n    let mut server = match HttpServer::new(&bind_path) {\n        Ok(s) => s,\n        Err(ServerError::IOError(inner)) if inner.kind() == std::io::ErrorKind::AddrInUse => {\n            let sock_path = bind_path.display().to_string();\n            return Err(ApiServerError::FailedToBindSocket(sock_path));\n        }\n        Err(err) => {\n            return Err(ApiServerError::FailedToBindAndRunHttpServer(err));\n        }\n    };\n    info_unrestricted!(\"Listening on API socket ({bind_path:?}).\");\n\n    let api_kill_switch_clone = api_kill_switch\n        .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","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/firecracker-microvm/firecracker/blob/0a745def42ddf4cc2a744d79a08a27ff50b5d27a/src/firecracker/src/api_server_adapter.rs#L179-L215","documentation":"Error \"Failed to clone API kill switch\" thrown in firecracker-microvm/firecracker.","triggerScenarios":"Thrown at src/firecracker/src/api_server_adapter.rs:197 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the process file-descriptor limit; cloning the kill-switch fd fails on fd exhaustion.","Verify the kill-switch eventfd is still open when cloned."],"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-14T05:17:10.506Z"}