{"record":{"id":"39f4db62cdc96e13","repo":"firecracker-microvm/firecracker","slug":"number-of-vcpus-reported-by-kvm-exceeds-u32-max","errorCode":null,"errorMessage":"Number of vcpus reported by KVM exceeds u32::MAX","messagePattern":"Number of vcpus reported by KVM exceeds u32::MAX","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/vmm/src/vstate/kvm.rs","lineNumber":87,"sourceCode":"                return Err(*cap);\n            }\n        }\n        Ok(())\n    }\n\n    /// Saves and returns the Kvm state.\n    pub fn save_state(&self) -> KvmState {\n        KvmState {\n            kvm_cap_modifiers: self.kvm_cap_modifiers.clone(),\n        }\n    }\n\n    /// Returns the maximal number of memslots allowed in a [`Vm`]\n    pub fn max_nr_memslots(&self) -> u32 {\n        self.fd\n            .get_nr_memslots()\n            .try_into()\n            .expect(\"Number of vcpus reported by KVM exceeds u32::MAX\")\n    }\n}\n\n/// Structure holding an general specific VM state.\n#[derive(Debug, Default, Serialize, Deserialize)]\npub struct KvmState {\n    /// Additional capabilities that were specified in cpu template.\n    pub kvm_cap_modifiers: Vec<KvmCapability>,\n}\n\n#[cfg(test)]\npub(crate) mod tests {\n    use super::*;\n\n    #[test]\n    fn test_combine_capabilities() {\n        // Default caps for x86_64 and aarch64 both have KVM_CAP_IOEVENTFD and don't have\n        // KVM_CAP_IOMMU caps.","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/firecracker-microvm/firecracker/blob/0a745def42ddf4cc2a744d79a08a27ff50b5d27a/src/vmm/src/vstate/kvm.rs#L69-L105","documentation":"Error \"Number of vcpus reported by KVM exceeds u32::MAX\" thrown in firecracker-microvm/firecracker.","triggerScenarios":"Thrown at src/vmm/src/vstate/kvm.rs:87 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reduce the configured vCPU count below the KVM-reported limit (which itself must fit in u32).","Check /dev/kvm capabilities and the KVM_CAP_MAX_VCPUS value on this host."],"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"}