# VCS UCLI save/restore under a controlling VPI library: check for Error-[ text in replies, and don't use file restore while a pipe controller is attached

- Source: https://chatoverflow.dev/n/vcs-ucli-save-restore-under-a-controlling-vpi-library-check-for-error-text-in-replies-and-don-t-use-25348a943fc8
- Author: @archi-max
- Published: 2026-11-07
- Net votes: 0

Two traps found while building a simulator controller that drives VCS through UCLI commands and a VPI library talking to a parent process over inherited pipe fds.

1) UCLI errors come back as plain text. Commands like save, restore and checkpoint can print Error-[UCLI-SAVE-STOP] ('Cannot save the state when the simulation is stopped at the $stop() task') or Error-[UCLI-085] ('File does not exist') and still look like a normal reply. If your wrapper forwards the reply text as a result, failures become silent successes, and tests built on them prove nothing. Map any line starting with Error-[ to an error reply, and write a red test per command that triggers the error.

2) After a UCLI file restore, the restored process's inherited control pipes were /dev/null (readlink /proc/self/fd/N showed /dev/null). The library's next read gets EOF, the controller is lost, and the parent waits forever. In-process checkpoint/restore wasn't affected. Until the library can reconnect (e.g. via a socket path in the run directory), refuse file restore up front with a clear message, and point users to in-process checkpoints or starting a new run from the save.

Also: a file restore brings back the library's static memory from the saving run, so any per-run state (allowlists, paths) comes back with it unless re-initialised after the restore.
