{"record":{"id":"cff7fea3de8def0b","repo":"OpenBMB/ChatDev","slug":"invalid-yaml","errorCode":"invalid_yaml","errorMessage":"invalid_yaml","messagePattern":"invalid_yaml","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"server/config_schema_router.py","lineNumber":50,"sourceCode":"        return build_schema_response(breadcrumbs)\n    except SchemaResolutionError:\n        return None\n\n\n@router.post(\"/schema\")\ndef get_schema(request: SchemaRequest) -> Dict[str, Any]:\n    try:\n        return build_schema_response(request.breadcrumbs)\n    except SchemaResolutionError as exc:\n        raise HTTPException(status_code=422, detail={\"message\": str(exc)}) from exc\n\n\n@router.post(\"/schema/validate\")\ndef validate_document(request: SchemaValidateRequest) -> Dict[str, Any]:\n    try:\n        parsed = yaml.safe_load(request.document)\n    except yaml.YAMLError as exc:\n        raise HTTPException(status_code=400, detail={\"message\": \"invalid_yaml\", \"error\": str(exc)}) from exc\n\n    if not isinstance(parsed, Mapping):\n        raise HTTPException(status_code=422, detail={\"message\": \"document_root_not_mapping\"})\n\n    try:\n        load_design_from_mapping(parsed)\n    except ConfigError as exc:\n        return {\n            \"valid\": False,\n            \"error\": str(exc),\n            \"path\": exc.path,\n            \"schema\": _resolve_schema(request.breadcrumbs),\n        }\n\n    return {\n        \"valid\": True,\n        \"schema\": _resolve_schema(request.breadcrumbs),\n    }","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/OpenBMB/ChatDev/blob/4fb2db0ea90375ce1059f44fe03ffbd191a7a169/server/config_schema_router.py#L32-L68","documentation":"The /schema/validate endpoint could not parse the submitted YAML document; yaml.safe_load raised a YAMLError. The raw parser message is included in the detail.error field. This happens before any schema validation, so nothing about the document's structure was checked yet.","triggerScenarios":"POST /schema/validate with a document containing syntax errors: bad indentation, unclosed quotes or brackets, tabs used for indentation, or duplicate keys under strict parsing.","commonSituations":"User-edited YAML files, LLM-generated YAML with inconsistent indentation, tabs pasted from editors, copy-paste artifacts that break block scalars.","solutions":["Fix the YAML syntax reported in detail.error (line/column is included)","Replace tabs with spaces in indentation","Validate locally with python -c \"import yaml,sys;yaml.safe_load(open(sys.argv[1]))\" file.yaml before submitting","Use a YAML linting plugin in your editor"],"exampleFix":"// before\ndocument: \"tasks:\\n\\t- name: run\"  // tab indentation\n// after\ndocument: \"tasks:\\n  - name: run\"","handlingStrategy":"validation","validationCode":"import yaml\ndef safe_yaml(doc: str):\n    try:\n        yaml.safe_load(doc)\n        return True\n    except yaml.YAMLError:\n        return False","typeGuard":null,"tryCatchPattern":"# server response is HTTP 400 with detail.message == 'invalid_yaml'\nif resp.status_code == 400 and resp.json()['detail']['message'] == 'invalid_yaml':\n    print(resp.json()['detail']['error'])  # parser message with line/col","preventionTips":["Lint YAML in CI before submitting","Configure editor to use spaces, show whitespace, and lint YAML"],"tags":["yaml","schema-validation","http-400"],"backgroundTag":"yaml-parse-error","analyzedSha":"4fb2db0ea90375ce1059f44fe03ffbd191a7a169","analyzedAt":"2026-08-27T14:35:29.622Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}