Fosowl/agenticSeek · error · ValueError
Empty path
Error message
Empty path
What it means
resolve_workspace_path() rejects any path argument that is None or consists only of whitespace by raising ValueError('Empty path'). The library requires a concrete, non-empty path string because it must join/resolve it against a workspace base directory; an empty path has no meaning there.
Source
Thrown at sources/workspace.py:80
"""Return True when path resolves inside directory (no traversal escape)."""
try:
path_real = os.path.realpath(os.path.abspath(path))
dir_real = os.path.realpath(os.path.abspath(directory))
return os.path.commonpath([path_real, dir_real]) == dir_real
except ValueError:
return False
def resolve_workspace_path(path: str, work_dir: str | None = None) -> str:
"""
Resolve a user or model-provided path inside the agent workspace.
Raises:
ValueError: empty path
PermissionError: resolved path escapes the workspace
"""
if path is None or not str(path).strip():
raise ValueError("Empty path")
base = work_dir or get_work_dir()
candidate = str(path).strip()
if os.path.isabs(candidate):
resolved = os.path.realpath(candidate)
else:
resolved = os.path.realpath(os.path.join(base, candidate))
if not is_within_directory(resolved, base):
raise PermissionError(
f"Path '{path}' is outside the agent workspace ({base})"
)
return resolved
View on GitHub (pinned to ae57a23577)
Solutions
- Ensure the path argument is a non-empty string before calling resolve_workspace_path; fall back to a sensible default (e.g. '.') if the variable is unset.
- Read the config/env value with a None-preserving default: os.environ.get('WORK_DIR') or DEFAULT_DIR instead of os.environ.get('WORK_DIR', '').
- Wrap the call in try/except ValueError and surface a clear message about which config key supplied the empty path.
Example fix
// before
resolved = resolve_workspace_path(cfg.get('input_path'))
// after
raw = cfg.get('input_path')
if raw is None or not str(raw).strip():
raise ValueError("config key 'input_path' must be a non-empty path")
resolved = resolve_workspace_path(raw) Defensive patterns
Strategy: validation
Validate before calling
def is_valid_path_arg(p):
return p is not None and str(p).strip() != ""
if not is_valid_path_arg(raw_path):
raise ValueError("path argument must be a non-empty string") Type guard
def has_path(p) -> bool:
return p is not None and isinstance(p, (str, bytes, os.PathLike)) and str(p).strip() != "" Try / catch
try:
resolved = resolve_workspace_path(raw)
except ValueError:
logger.error("empty or missing path supplied to resolve_workspace_path")
resolved = resolve_workspace_path(DEFAULT_RELATIVE_PATH) Prevention
- Use 'or DEFAULT' (not '' defaults) when reading path values from env/config.
- Validate all path-bearing config keys at startup, before any resolution calls.
- Never pass values straight from cfg.get() / os.environ.get() into path APIs without an emptiness check.
- Unit-test the empty/whitespace-only path cases (the library's own tests do exactly this).
When it happens
Trigger: Calling resolve_workspace_path(None, ...) or resolve_workspace_path(' ', ...); passing an unset config variable (e.g. resolve_workspace_path(cfg.get('path'))); passing an empty string from a CLI arg or environment variable default.
Common situations: Config files where the workspace path key is missing or set to '' ; environment variables like WORK_DIR not set; callers defaulting with something like os.environ.get('PATH_VAR', '') which yields an empty string instead of None; upstream normalization (e.g. .strip()) that emptied an otherwise valid value.
Related errors
- Unknown provider: {provider_name}
- Model not set
- Ollama connection failed. is the server running ?
- Tool must be a callable object (a method)
- Prompt file not found at path: {file_path}
AI-assisted analysis of Fosowl/agenticSeek@ae57a23577 (2026-08-30).
Data as JSON: /api/errors/eeb4238c5681ed48.
Report an issue: GitHub.