Skip to content

[Bug] Unhandled FileNotFoundError in CLI Rollback Command #558

@rishabh0510rishabh

Description

@rishabh0510rishabh

[Bug] Unhandled FileNotFoundError in CLI Rollback Command

Description:
The rollback command attempts to restore a virtual environment from a backup directory. If the backup directory is deleted by another process after the list is displayed but before the user confirms the rollback, the command crashes with an unhandled FileNotFoundError.

Context:

  • cli/envforge_agent/cli.py

Steps to Reproduce:

  1. Run envforge rollback and wait at the selection prompt.
  2. In another terminal, delete the selected backup directory.
  3. Confirm the selection in the CLI.
  4. The CLI crashes with a raw traceback.

Current Behavior:
shutil.copytree is called without verifying the source directory still exists at execution time.

Expected Behavior:
The command should verify the source directory exists immediately before copying and raise a clean error if it is missing.

Suggested Fix/Remediation:
Add an existence check before copying:

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions