{"record":{"id":"7bf577f67e583a76","repo":"aio-libs/aiohttp","slug":"no-start-or-end-of-range-specified","errorCode":null,"errorMessage":"No start or end of range specified","messagePattern":"No start or end of range specified","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"aiohttp/web_request.py","lineNumber":631,"sourceCode":"                raise ValueError(\"range not in acceptable format\")\n\n            end = int(end) if end else None\n            start = int(start) if start else None\n\n            if start is None and end is not None:\n                # end with no start is to return tail of content\n                start = -end\n                end = None\n\n            if start is not None and end is not None:\n                # end is inclusive in range header, exclusive for slice\n                end += 1\n\n                if start >= end:\n                    raise ValueError(\"start cannot be after end\")\n\n            if start is end is None:  # No valid range supplied\n                raise ValueError(\"No start or end of range specified\")\n\n        return slice(start, end, 1)\n\n    @reify\n    def content(self) -> StreamReader:\n        \"\"\"Return raw payload stream.\"\"\"\n        return self._payload\n\n    @property\n    def can_read_body(self) -> bool:\n        \"\"\"Return True if request's HTTP BODY can be read, False otherwise.\"\"\"\n        return not self._payload.at_eof()\n\n    @reify\n    def body_exists(self) -> bool:\n        \"\"\"Return True if request has HTTP BODY, False otherwise.\"\"\"\n        return type(self._payload) is not EmptyStreamReader\n","sourceCodeStart":613,"sourceCodeEnd":649,"githubUrl":"https://github.com/aio-libs/aiohttp/blob/d041d4d0fd48c3f0832084d33be16cf1c4835f85/aiohttp/web_request.py#L613-L649","documentation":"When the Range header matches the regex but both captures are empty (e.g. Range: bytes=-), neither start nor end is derivable, so http_range raises ValueError('No start or end of range specified'). It is distinct from the format error: the syntax matched but no usable bound was supplied.","triggerScenarios":"Client sends exactly Range: bytes=- (both start and end blank).","commonSituations":"Bug in a download manager that constructs Range from empty variables; probing/HEAD-like requests.","solutions":["Catch ValueError around request.http_range and treat the request as a full-content request.","Respond 416 Range Not Satisfiable if a range is mandatory.","Strip empty Range headers at the reverse proxy."],"exampleFix":"try:\n    rng = request.http_range\nexcept ValueError:\n    rng = slice(None)   # serve full content","handlingStrategy":"try-catch","validationCode":"rng_raw = request.headers.get('Range')\nif rng_raw == 'bytes=-':\n    rng = slice(None)  # serve full content","typeGuard":null,"tryCatchPattern":"try:\n    rng = request.http_range\nexcept ValueError:\n    rng = slice(None)  # treat as no range","preventionTips":["Treat a blank Range as a full-content request.","Distinguish format errors from empty-range errors in your handler.","Strip empty Range headers at the proxy."],"tags":["range","validation","http-header"],"backgroundTag":null,"analyzedSha":"d041d4d0fd48c3f0832084d33be16cf1c4835f85","analyzedAt":"2026-08-11T20:44:15.550Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}