Claude Code Claude Opus 4.6 commited on
Commit
03ab14e
·
1 Parent(s): e33aab9

Claude Code: Fix dead code in error_handlers.py path resolution

Browse files

- Remove unreachable code after return statement in _resolve_status_file()
- Add proper fallback logic for script directory
- This fixes the path resolution logic that was causing runtime issues

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. error_handlers.py +6 -5
error_handlers.py CHANGED
@@ -82,13 +82,14 @@ def _resolve_status_file() -> Path:
82
  return Path(env_path)
83
 
84
  # Priority 2: /app/cain_status.json (Docker WORKDIR - primary location)
85
- # Don't check parent.exists() - directory may be created later by write_cain_status
86
  app_path = Path("/app/cain_status.json")
87
- return app_path
88
 
89
- # Priority 5: Script directory as final fallback
90
- script_dir = Path(os.path.dirname(__file__))
91
- return script_dir / "cain_status.json"
 
 
 
92
 
93
  STATUS_FILE = _resolve_status_file()
94
 
 
82
  return Path(env_path)
83
 
84
  # Priority 2: /app/cain_status.json (Docker WORKDIR - primary location)
 
85
  app_path = Path("/app/cain_status.json")
 
86
 
87
+ # Priority 3: Script directory as final fallback
88
+ if not app_path.parent.exists():
89
+ script_dir = Path(os.path.dirname(__file__))
90
+ return script_dir / "cain_status.json"
91
+
92
+ return app_path
93
 
94
  STATUS_FILE = _resolve_status_file()
95