firecracker-microvm/firecracker · error

Number of vcpus reported by KVM exceeds u32::MAX

Error message

Number of vcpus reported by KVM exceeds u32::MAX

What it means

Error "Number of vcpus reported by KVM exceeds u32::MAX" thrown in firecracker-microvm/firecracker.

Source

Thrown at src/vmm/src/vstate/kvm.rs:87

                return Err(*cap);
            }
        }
        Ok(())
    }

    /// Saves and returns the Kvm state.
    pub fn save_state(&self) -> KvmState {
        KvmState {
            kvm_cap_modifiers: self.kvm_cap_modifiers.clone(),
        }
    }

    /// Returns the maximal number of memslots allowed in a [`Vm`]
    pub fn max_nr_memslots(&self) -> u32 {
        self.fd
            .get_nr_memslots()
            .try_into()
            .expect("Number of vcpus reported by KVM exceeds u32::MAX")
    }
}

/// Structure holding an general specific VM state.
#[derive(Debug, Default, Serialize, Deserialize)]
pub struct KvmState {
    /// Additional capabilities that were specified in cpu template.
    pub kvm_cap_modifiers: Vec<KvmCapability>,
}

#[cfg(test)]
pub(crate) mod tests {
    use super::*;

    #[test]
    fn test_combine_capabilities() {
        // Default caps for x86_64 and aarch64 both have KVM_CAP_IOEVENTFD and don't have
        // KVM_CAP_IOMMU caps.

View on GitHub (pinned to 0a745def42)

Solutions

  1. Reduce the configured vCPU count below the KVM-reported limit (which itself must fit in u32).
  2. Check /dev/kvm capabilities and the KVM_CAP_MAX_VCPUS value on this host.

When it happens

Trigger: Thrown at src/vmm/src/vstate/kvm.rs:87 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of firecracker-microvm/firecracker@0a745def42 (2026-08-19). Data as JSON: /api/errors/39f4db62cdc96e13. Report an issue: GitHub.