Using bsdinstall for scripting VM image preparation leads to bizarre failures because the file used to keep track of ESPs created by the scriptedpart subprogram does not get cleaned up after use, causing new entries to be appended to the file by subsequent invocations of the partitioner. This would leave the contents of the file something like zvol/storage/bhyve/13.0-CURRENT/r356085/templatep1zvol/storage/bhyve/13.0-CURRENT/r356085/templatep1zvol/storage/bhyve/13.0-CURRENT/r356085/templatep1 for example, breaking the ESP preparation script.
To resolve this issue, the file can simply be removed before partitioning.
The lack of space also indicated another potential error. The intent suggested by surrounding code seems to be that multiple ESPs should be possible. Adding a newline after each entry in the bsdinstall-esps file should fix this.
Sponsored by: iXsystems, Inc.