OpenBMB/ChatDev · error · ConfigError
expected string
Error message
expected string
What it means
ValidationError raised when the filename contains characters outside [a-zA-Z0-9._-]; spaces, slashes and unicode are rejected. Note a plain 'Invalid filename format' SecurityError exists separately for traversal patterns.
Source
Thrown at entity/configs/base.py:227
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
def optional_str(data: Mapping[str, Any], key: str, path: str) -> str | None:
value = data.get(key)
if value is None or value == "":
return None
key_path = f"{path}.{key}" if path else key
if not isinstance(value, str):
raise ConfigError("expected string", key_path)
return value
def require_bool(data: Mapping[str, Any], key: str, path: str) -> bool:
value = data.get(key)
key_path = f"{path}.{key}" if path else keyView on GitHub (pinned to 4fb2db0ea9)
Solutions
- Rename to only letters, digits, dots, underscores, hyphens.
- Sanitize with a client-side regex before the request.
- Avoid unicode/space characters in workflow names by design.
Example fix
# before filename = 'my flow (final).yaml' # after import re filename = re.sub(r'[^a-zA-Z0-9._-]', '_', 'my flow (final)') + '.yaml' # my_flow__final_.yaml
Defensive patterns
Strategy: validation
Validate before calling
if (!/^[a-zA-Z0-9._-]+$/.test(name)) name = name.replace(/[^a-zA-Z0-9._-]/g, '_');
Type guard
const isValidWorkflowName = (n: string) => /^[a-zA-Z0-9._-]+$/.test(n);
Prevention
- Adopt an ASCII naming convention for workflows
- Sanitize user-supplied titles before file operations
When it happens
Trigger: Filenames like 'my flow.yaml', 'flow(1).yaml', '流程.yaml', or any character not in the allowed set passed to workflow endpoints.
Common situations: Natural-language titles used as filenames; files copied from Windows/other locales; renamed downloads with parentheses or spaces.
Related errors
- expected mapping
- 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/6e51784e845df75f.
Report an issue: GitHub.