OpenBMB/ChatDev · error · ConfigError
expected mapping
Error message
expected mapping
What it means
ValidationError thrown by validate_workflow_filename when the supplied name is empty or whitespace-only after stripping. Propagates to route handlers (get args/desc, delete, rename, copy, raw content) usually as a 400.
Source
Thrown at entity/configs/base.py:214
def ensure_list(value: Any) -> List[Any]:
if value is None:
return []
if isinstance(value, list):
return list(value)
if isinstance(value, (tuple, set)):
return list(value)
return [value]
def ensure_dict(value: Mapping[str, Any] | None) -> Dict[str, Any]:
if value is None:
return {}
if isinstance(value, MutableMapping):
return dict(value)
if isinstance(value, Mapping):
return dict(value)
raise ConfigError("expected mapping", path=str(value))
def require_mapping(data: Any, path: str) -> Mapping[str, Any]:
if not isinstance(data, Mapping):
raise ConfigError("expected mapping", path)
return data
def require_str(data: Mapping[str, Any], key: str, path: str, *, allow_empty: bool = False) -> str:
value = data.get(key)
key_path = f"{path}.{key}" if path else key
if not isinstance(value, str):
raise ConfigError("expected string", key_path)
if not allow_empty and not value.strip():
raise ConfigError("expected non-empty string", key_path)
return value
View on GitHub (pinned to 4fb2db0ea9)
Solutions
- Pass a real filename with .yaml/.yml extension.
- Guard client-side against empty names before calling the API.
- Debug the URL/payload construction that produced the empty value.
Example fix
# before
resp = client.get(f"/api/workflows/{name}/args") # name == ''
# after
assert name.strip(), 'workflow filename required'
resp = client.get(f"/api/workflows/{name}/args") Defensive patterns
Strategy: validation
Validate before calling
if (!filename?.trim()) throw new Error('filename required'); Type guard
const isNonEmptyName = (n?: string): n is string => !!n && n.trim().length > 0;
Prevention
- Assert non-empty name before any workflow file call
- Lint against empty path segments in URL builders
When it happens
Trigger: Calling any workflow file endpoint with filename="", " ", or None (which coerces to empty via '(filename or "")').
Common situations: URL construction bugs producing empty path segments; frontend sending an unset variable; scripted bulk operations hitting files with blank names in a list.
Related errors
- expected string
- Unsupported node type '{ntype}' for node '{nid}'. Only {allo
- YAML root must be a mapping
- expected non-empty string
- Task prompt cannot be empty
AI-assisted analysis of OpenBMB/ChatDev@4fb2db0ea9 (2026-08-27).
Data as JSON: /api/errors/a314321c220ddf3d.
Report an issue: GitHub.