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

  1. Pass a real filename with .yaml/.yml extension.
  2. Guard client-side against empty names before calling the API.
  3. 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

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


AI-assisted analysis of OpenBMB/ChatDev@4fb2db0ea9 (2026-08-27). Data as JSON: /api/errors/a314321c220ddf3d. Report an issue: GitHub.