-
Notifications
You must be signed in to change notification settings - Fork 212
Closed
Description
Description
When running the dstack CLI in a sandboxed environment (e.g., from an AI coding agent), the CLI crashes if it cannot write to the log file at ~/.dstack/logs/cli/latest.log.
Steps to Reproduce
- Run the
dstackCLI in an environment where writing to~/.dstack/logs/cli/is restricted (e.g., a sandboxed process) - Any CLI command fails with a
PermissionError
Error
Traceback (most recent call last):
File "/Users/cheptsov/.local/bin/dstack", line 10, in <module>
sys.exit(main())
...
File ".../dstack/_internal/cli/utils/common.py", line 87, in configure_logging
file_handler = logging.FileHandler(log_file)
...
PermissionError: [Errno 1] Operation not permitted: '/Users/cheptsov/.dstack/logs/cli/latest.log'
Expected Behavior
The CLI should print a warning about the inability to write logs but continue executing normally, falling back to stdout-only logging.
Proposed Fix
Wrap the file handler creation in configure_logging() with a try-except block to catch PermissionError specifically, print a warning, and continue without file logging.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels