There is a mechanism called `getError` that is used for VM/native integration for `os.nim`: proc getError: string = builtin ... result.registerCallback "stdlib.system.getError", proc (a: VmArgs) = setResult(a, errorMsg) Run
You could use the existing `getError` or a similar mechanism to communiate errors between the native and the VM code.