affaan-m/ECC · error · ValueError
Path is not a valid directory
Error message
Path is not a valid directory: {canonical!r} What it means
Raised by launch_terminal in scripts/lib/ecc_dashboard_runtime.py when the requested path fails the os.path.isdir check after canonicalization via os.path.realpath. The function refuses to spawn a terminal subprocess pointing at a nonexistent or non-directory target, because the subsequent build_terminal_launch/Popen call assumes a valid working directory. It is a defensive pre-flight validation before process launch.
Solutions
- Verify the path exists and is a directory before calling launch_terminal (os.path.isdir(os.path.realpath(path))).
- Fix the dashboard/config value that supplied the wrong path (stale workspace, typo, file instead of directory).
- Create the missing directory if it is expected to exist (os.makedirs(path, exist_ok=True)).
- Handle the ValueError in open_terminal and surface a friendly message or fall back to the default working directory.
Example fix
// before
launch_terminal(workspace_path) # may be stale
// after
if os.path.isdir(os.path.realpath(workspace_path)):
launch_terminal(workspace_path)
else:
print(f"workspace not found: {workspace_path}") Defensive patterns
Strategy: validation
Validate before calling
import os
if not os.path.isdir(os.path.realpath(path)):
raise FileNotFoundError(f"not a directory: {path}") Type guard
def is_valid_directory(path: str) -> bool:
return os.path.isdir(os.path.realpath(path)) Try / catch
try:
launch_terminal(path)
except ValueError as e:
print(f"cannot open terminal: {e}") Prevention
- Check os.path.isdir on the realpath before launching
- Keep workspace paths in config freshly validated at startup
- Prefer directories over files when configuring terminal openers
- Handle deleted/renamed workspaces by refreshing the dashboard state
When it happens
Trigger: Calling launch_terminal (directly or via open_terminal) with a path that does not exist, points at a regular file, or is a dangling symlink so realpath resolves to a non-directory.
Common situations: Dashboard passes a stale workspace directory that was deleted or renamed while the dashboard ran; user config points the terminal opener at a file instead of a directory; symlink targets removed on a mounted volume.
Related errors
- output must have a video suffix distinct from…
- Path does not exist
- all overlays must be readable local files
- all takes must be readable local files
- application bundle differs from its bound evidence
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/b2ad29dbae5b1bfd.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/lib/ecc_dashboard_runtime.py:68
'cwd': path,
'creationflags': creationflags,
},
)
if resolved_system_name == 'Darwin':
return (['open', '-a', 'Terminal', path], {})
return (
['x-terminal-emulator', '-e', 'bash', '-lc', 'cd -- "$1"; exec bash', 'bash', path],
{},
)
def launch_terminal(path: str) -> None:
"""Open a terminal at the given path after validating the target directory."""
canonical = os.path.realpath(path)
if not os.path.isdir(canonical):
raise ValueError(f"Path is not a valid directory: {canonical!r}")
argv, kwargs = build_terminal_launch(canonical)
subprocess.Popen(argv, **kwargs) # noqa: S603 - list argv, no shell=True, path validated above
View on GitHub (pinned to 8321021c54)