OpenBMB/ChatDev · error · ValueError
package names cannot be empty
Error message
package names cannot be empty
What it means
Each package spec is stripped of whitespace and must be non-empty; empty strings or whitespace-only entries raise ValueError. This catches degenerate list entries like "" or " " that would otherwise produce a broken uv command line.
Source
Thrown at functions/function_calling/uv_related.py:71
return path
def resolve_under_workspace(self, relative_path: str | Path) -> Path:
candidate = Path(relative_path)
absolute = candidate if candidate.is_absolute() else self.workspace_root / candidate
absolute = absolute.expanduser().resolve()
if self.workspace_root not in absolute.parents and absolute != self.workspace_root:
raise ValueError("script path is outside workspace root")
return absolute
def _validate_packages(packages: Sequence[str]) -> List[str]:
normalized: List[str] = []
for pkg in packages:
if not isinstance(pkg, str):
raise ValueError("package entries must be strings")
stripped = pkg.strip()
if not stripped:
raise ValueError("package names cannot be empty")
if not _SAFE_PACKAGE_RE.match(stripped):
raise ValueError(f"unsafe characters detected in package spec {pkg}")
if stripped.startswith("-"):
raise ValueError(f"flags are not allowed in packages list: {pkg}")
normalized.append(stripped)
if not normalized:
raise ValueError("at least one package is required")
return normalized
def _coerce_timeout_seconds(timeout_seconds: Any) -> float | None:
if timeout_seconds is None:
return None
if isinstance(timeout_seconds, bool):
raise ValueError("timeout_seconds must be a number")
if isinstance(timeout_seconds, (int, float)):
value = float(timeout_seconds)
elif isinstance(timeout_seconds, str):View on GitHub (pinned to 4fb2db0ea9)
Solutions
- Filter empties before calling: [p for p in packages if p and p.strip()]
- Fix the splitting logic to drop empty fields (e.g. [x for x in raw.split(",") if x.strip()])
- Validate against a schema with minLength on package entries
Example fix
# before
install_python_packages(packages="numpy,,pandas".split(","))
# after
install_python_packages(packages=[p for p in "numpy,,pandas".split(",") if p.strip()]) Defensive patterns
Strategy: validation
Validate before calling
packages = [p.strip() for p in packages if isinstance(p, str) and p.strip()]
if not packages:
raise ValueError("no packages requested")
install_python_packages(packages=packages, _context=ctx) Type guard
def no_empty_entries(packages) -> bool:
return all(isinstance(p, str) and p.strip() for p in packages) Try / catch
try:
install_python_packages(packages=packages, _context=ctx)
except ValueError as e:
if "cannot be empty" in str(e):
packages = [p for p in packages if p and p.strip()]
install_python_packages(packages=packages, _context=ctx)
else:
raise Prevention
- Filter empty fields when splitting comma-separated input
- Drop blank form fields before assembling the list
- Use schema minLength: 1 on array items
When it happens
Trigger: Passing packages=["", "numpy"] or packages=[" "]; strings built from empty variables or split of an empty string ("".split() vs "".split(",")); trailing commas producing empty fields ("numpy,".split(",")).
Common situations: Splitting a comma-separated user input with trailing/double commas; config defaults of empty string; form fields left blank but included in the list.
Related errors
- package entries must be strings
- unsafe characters detected in package spec {pkg}
- flags are not allowed in packages list: {pkg}
- No node types registered; cannot validate workflow
- Unsupported node type '{ntype}' for node '{nid}'. Only {allo
AI-assisted analysis of OpenBMB/ChatDev@4fb2db0ea9 (2026-08-27).
Data as JSON: /api/errors/581ad2cd786c47e8.
Report an issue: GitHub.