{"record":{"id":"fb139eb9e25ad2e8","repo":"mitmproxy/mitmproxy","slug":"bad-http-response-line-line-r","errorCode":null,"errorMessage":"Bad HTTP response line: {line!r}","messagePattern":"Bad HTTP response line: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mitmproxy/net/http/http1/read.py","lineNumber":214,"sourceCode":"\n        raise_if_http_version_unknown(http_version)\n    except ValueError as e:\n        raise ValueError(f\"Bad HTTP request line: {line!r}\") from e\n\n    return host, port, method, scheme, authority, path, http_version\n\n\ndef _read_response_line(line: bytes) -> tuple[bytes, int, bytes]:\n    try:\n        parts = line.split(None, 2)\n        if len(parts) == 2:  # handle missing message gracefully\n            parts.append(b\"\")\n\n        http_version, status_code_str, reason = parts\n        status_code = int(status_code_str)\n        raise_if_http_version_unknown(http_version)\n    except ValueError as e:\n        raise ValueError(f\"Bad HTTP response line: {line!r}\") from e\n\n    return http_version, status_code, reason\n\n\ndef _read_headers(lines: Iterable[bytes]) -> Headers:\n    \"\"\"\n    Read a set of headers.\n    Stop once a blank line is reached.\n\n    Returns:\n        A headers object\n\n    Raises:\n        exceptions.HttpSyntaxException\n    \"\"\"\n    ret: list[tuple[bytes, bytes]] = []\n    for line in lines:\n        if line[0] in b\" \\t\":","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/mitmproxy/mitmproxy/blob/2ac5b089d953585c66026a53f678270e094e48e5/mitmproxy/net/http/http1/read.py#L196-L232","documentation":"Error \"Bad HTTP response line: {line!r}\" thrown in mitmproxy/mitmproxy.","triggerScenarios":"Thrown at mitmproxy/net/http/http1/read.py:214 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":"2ac5b089d953585c66026a53f678270e094e48e5","analyzedAt":"2026-08-26T07:49:02.629Z","schemaVersion":2},"datasetVersion":"2026-08-26T14:46:13.012Z"}