{"record":{"id":"a314321c220ddf3d","repo":"OpenBMB/ChatDev","slug":"expected-mapping","errorCode":null,"errorMessage":"expected mapping","messagePattern":"expected mapping","errorType":"validation","errorClass":"ConfigError","httpStatus":null,"severity":"error","filePath":"entity/configs/base.py","lineNumber":214,"sourceCode":"\ndef ensure_list(value: Any) -> List[Any]:\n    if value is None:\n        return []\n    if isinstance(value, list):\n        return list(value)\n    if isinstance(value, (tuple, set)):\n        return list(value)\n    return [value]\n\n\ndef ensure_dict(value: Mapping[str, Any] | None) -> Dict[str, Any]:\n    if value is None:\n        return {}\n    if isinstance(value, MutableMapping):\n        return dict(value)\n    if isinstance(value, Mapping):\n        return dict(value)\n    raise ConfigError(\"expected mapping\", path=str(value))\n\n\ndef require_mapping(data: Any, path: str) -> Mapping[str, Any]:\n    if not isinstance(data, Mapping):\n        raise ConfigError(\"expected mapping\", path)\n    return data\n\n\ndef require_str(data: Mapping[str, Any], key: str, path: str, *, allow_empty: bool = False) -> str:\n    value = data.get(key)\n    key_path = f\"{path}.{key}\" if path else key\n    if not isinstance(value, str):\n        raise ConfigError(\"expected string\", key_path)\n    if not allow_empty and not value.strip():\n        raise ConfigError(\"expected non-empty string\", key_path)\n    return value\n\n","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/OpenBMB/ChatDev/blob/4fb2db0ea90375ce1059f44fe03ffbd191a7a169/entity/configs/base.py#L196-L232","documentation":"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.","triggerScenarios":"Calling any workflow file endpoint with filename=\"\", \"  \", or None (which coerces to empty via '(filename or \"\")').","commonSituations":"URL construction bugs producing empty path segments; frontend sending an unset variable; scripted bulk operations hitting files with blank names in a list.","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."],"exampleFix":"# before\nresp = client.get(f\"/api/workflows/{name}/args\")  # name == ''\n# after\nassert name.strip(), 'workflow filename required'\nresp = client.get(f\"/api/workflows/{name}/args\")","handlingStrategy":"validation","validationCode":"if (!filename?.trim()) throw new Error('filename required');","typeGuard":"const isNonEmptyName = (n?: string): n is string => !!n && n.trim().length > 0;","tryCatchPattern":null,"preventionTips":["Assert non-empty name before any workflow file call","Lint against empty path segments in URL builders"],"tags":["workflow","validation","filename"],"backgroundTag":"required-field-missing","analyzedSha":"4fb2db0ea90375ce1059f44fe03ffbd191a7a169","analyzedAt":"2026-08-27T14:35:29.622Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}