{"record":{"id":"130022c7fa4f9d81","repo":"rohitg00/ai-engineering-from-scratch","slug":"malformed-line-line-r","errorCode":null,"errorMessage":"malformed line: {line!r}","messagePattern":"malformed line: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"phases/19-capstone-projects/86-constitutional-rules-engine/code/yaml_subset.py","lineNumber":120,"sourceCode":"\n\ndef _parse_mapping(lines: list[str], start: int, indent: int) -> tuple[dict[str, Any], int]:\n    out: dict[str, Any] = {}\n    i = start\n    while i < len(lines):\n        line = lines[i]\n        cur_indent = _indent_of(line)\n        if cur_indent < indent:\n            break\n        if cur_indent > indent:\n            i += 1\n            continue\n        stripped = line.lstrip()\n        if stripped.startswith(\"- \"):\n            break\n        m = re.match(r\"^([A-Za-z_][\\w-]*)\\s*:\\s*(.*)$\", stripped)\n        if not m:\n            raise ValueError(f\"malformed line: {line!r}\")\n        key = m.group(1)\n        rest = m.group(2)\n        if rest.strip() == \"\":\n            if i + 1 < len(lines) and _indent_of(lines[i + 1]) > indent:\n                value, i = _parse_block(lines, i + 1, _indent_of(lines[i + 1]))\n                out[key] = value\n                continue\n            out[key] = None\n            i += 1\n        else:\n            out[key] = _coerce(rest)\n            i += 1\n    return out, i\n\n\ndef _parse_sequence(lines: list[str], start: int, indent: int) -> tuple[list[Any], int]:\n    out: list[Any] = []\n    i = start","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/phases/19-capstone-projects/86-constitutional-rules-engine/code/yaml_subset.py#L102-L138","documentation":"Error \"malformed line: {line!r}\" thrown in rohitg00/ai-engineering-from-scratch.","triggerScenarios":"Thrown at phases/19-capstone-projects/86-constitutional-rules-engine/code/yaml_subset.py:120 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"39ea8a1c6d0b61f071226eff7ede4d4105fed820","analyzedAt":"2026-08-26T03:13:46.626Z","schemaVersion":2},"datasetVersion":"2026-08-26T07:17:17.940Z"}