The disk-format command (in guestfish, or the guestfs_disk_format API) takes a host file and tries to work out the disk format. This works fine for any file which exists on the host. However if the host file does not exist, you get a strange error: $ guestfish disk-format /etc/nosuchfile libguestfs: error: qemu-img info: JSON parse error: parse error: premature EOF (right here) ------^ libguestfs: error: qemu-img info: /etc/nosuchfile: qemu-img info exited with error status 1. To see full error messages you may need to enable debugging. See http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs
Fixed upstream in: https://github.com/libguestfs/libguestfs/commit/aecb5f4b33107935191099dbd5559113f59ee51c https://github.com/libguestfs/libguestfs/commit/d50cb7bbb4cc18f69ea1425e9f5cee9685825f95 https://github.com/libguestfs/libguestfs/commit/28e08776824dd3152638e647259c2f4701a0a577 and the last one is a regression test: https://github.com/libguestfs/libguestfs/commit/2311fb0632a64cfa2bab8bf65c82ffaa042d619e