You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CLI crashes with 'Operation not permitted' when log file is not writable #3537
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 dstack CLI 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.
Activity
CLI crashes with 'Operation not permitted' when log file is not writa…
CLI crashes with 'Operation not permitted' when log file is not writa…