{"record":{"id":"a33e4b86cc52c84d","repo":"rohitg00/ai-engineering-from-scratch","slug":"unsupported-url-scheme-parsed-scheme-r-for-shard","errorCode":null,"errorMessage":"unsupported URL scheme {parsed.scheme!r} for shard {plan.shard_id}","messagePattern":"unsupported URL scheme (.+?) for shard (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"phases/19-capstone-projects/42-large-corpus-downloader/code/main.py","lineNumber":315,"sourceCode":"            return False\n        actual_size = shard_path.stat().st_size\n        if actual_size != state.verified_bytes:\n            return False\n        hasher = hashlib.sha256()\n        with shard_path.open(\"rb\") as fh:\n            remaining = state.verified_bytes\n            while remaining > 0:\n                buf = fh.read(min(self.chunk_bytes, remaining))\n                if not buf:\n                    return False\n                hasher.update(buf)\n                remaining -= len(buf)\n        return hasher.hexdigest() == state.sha256_prefix_hex\n\n    def download(self, plan: ShardPlan) -> ShardResult:\n        parsed = urllib.parse.urlparse(plan.url)\n        if parsed.scheme not in {\"http\", \"https\", \"file\"}:\n            raise ValueError(\n                f\"unsupported URL scheme {parsed.scheme!r} for shard {plan.shard_id}\"\n            )\n        shard_path, checkpoint_path = self._paths_for(plan.shard_id)\n        state = self._read_checkpoint(checkpoint_path)\n        resume_from = 0\n        rolling = hashlib.sha256()\n        if state is not None and state.url == plan.url and self._verify_partial(shard_path, state):\n            resume_from = state.verified_bytes\n            with shard_path.open(\"rb\") as fh:\n                remaining = resume_from\n                while remaining > 0:\n                    buf = fh.read(min(self.chunk_bytes, remaining))\n                    if not buf:\n                        break\n                    rolling.update(buf)\n                    remaining -= len(buf)\n        else:\n            if shard_path.exists():","sourceCodeStart":297,"sourceCodeEnd":333,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/phases/19-capstone-projects/42-large-corpus-downloader/code/main.py#L297-L333","documentation":"Error \"unsupported URL scheme {parsed.scheme!r} for shard {plan.shard_id}\" thrown in rohitg00/ai-engineering-from-scratch.","triggerScenarios":"Thrown at phases/19-capstone-projects/42-large-corpus-downloader/code/main.py:315 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"}