Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Error Handling

Approach

vm-manager uses miette for rich diagnostic error reporting. Every error variant includes:

  • A human-readable message.
  • A diagnostic code (e.g., vm_manager::qemu::spawn_failed).
  • A help message telling the user what to do.

Errors are defined with #[derive(thiserror::Error, miette::Diagnostic)].

Error Variants

CodeTriggerHelp
vm_manager::qemu::spawn_failedQEMU process failed to startEnsure qemu-system-x86_64 is installed, in PATH, and KVM is available (/dev/kvm)
vm_manager::qemu::qmp_connect_failedCan't connect to QMP socketQEMU may have crashed before QMP socket ready; check work directory logs
vm_manager::qemu::qmp_command_failedQMP command returned an error(varies)
vm_manager::image::overlay_creation_failedQCOW2 overlay creation failedEnsure qemu-img is installed and base image exists and is readable
vm_manager::network::ip_discovery_timeoutGuest IP not foundGuest may not have DHCP lease; check network config and cloud-init
vm_manager::propolis::unreachableCan't reach propolis-serverEnsure propolis-server is running and listening on expected address
vm_manager::cloudinit::iso_failedSeed ISO generation failedEnsure genisoimage or mkisofs installed, or enable pure-iso feature
vm_manager::ssh::failedSSH connection or command failedCheck SSH key, guest reachability, and sshd running
vm_manager::ssh::keygen_failedEd25519 key generation failedInternal error; please report it
vm_manager::image::download_failedImage download failedCheck network connectivity and URL correctness
vm_manager::image::format_detection_failedCan't detect image formatEnsure qemu-img installed and file is valid disk image
vm_manager::image::conversion_failedImage format conversion failedEnsure qemu-img installed and sufficient disk space
vm_manager::vm::not_foundVM not in storeRun vmctl list to see available VMs
vm_manager::vm::invalid_stateOperation invalid for current state(varies)
vm_manager::backend::not_availableBackend not supported on platformBackend not supported on current platform
vm_manager::vmfile::not_foundVMFile.kdl not foundCreate VMFile.kdl in current directory or specify path with --file
vm_manager::vmfile::parse_failedKDL syntax errorCheck VMFile.kdl syntax; see https://kdl.dev
vm_manager::vmfile::validationVMFile validation error(custom hint per error)
vm_manager::provision::failedProvisioner step failedCheck provisioner config and VM SSH reachability
vm_manager::ioGeneral I/O error(transparent)

Type Alias

The library defines pub type Result<T> = std::result::Result<T, VmError> for convenience. CLI commands return miette::Result<()> for rich terminal output.