{"record":{"id":"9b8516a04fafc338","repo":"github/copilot-sdk","slug":"failed-to-read-runtime-package-entry-member-name","errorCode":null,"errorMessage":"Failed to read runtime package entry: {member.name}","messagePattern":"Failed to read runtime package entry: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/copilot/_cli_download.py","lineNumber":313,"sourceCode":"        relative = relative[2:]\n    destination = Path(*relative)\n    if destination.is_absolute() or \"..\" in destination.parts:\n        raise RuntimeError(f\"Unsafe runtime package path: {member_name}\")\n    return destination\n\n\ndef _materialize_runtime_bundle(data: bytes, runtime_platform: str, destination: Path) -> None:\n    \"\"\"Extract the hostless runtime tree, retaining unknown package assets by default.\"\"\"\n    with tarfile.open(fileobj=io.BytesIO(data), mode=\"r:gz\") as archive:\n        for member in archive:\n            relative = _hostless_runtime_path(member.name, runtime_platform)\n            if relative is None or member.isdir():\n                continue\n            if not member.isfile():\n                raise RuntimeError(f\"Unsupported runtime package entry: {member.name}\")\n            extracted = archive.extractfile(member)\n            if extracted is None:\n                raise RuntimeError(f\"Failed to read runtime package entry: {member.name}\")\n            target = destination / relative\n            target.parent.mkdir(parents=True, exist_ok=True)\n            target.write_bytes(extracted.read())\n            if sys.platform != \"win32\":\n                target.chmod(member.mode & 0o777)\n\n\ndef ensure_runtime_wrapper(version: str | None = None, force: bool = False) -> str:\n    \"\"\"Provision the runtime pair and retained assets from the release package.\"\"\"\n    ver = version or CLI_VERSION\n    if not ver:\n        raise RuntimeError(\"No runtime version is pinned.\")\n    runtime_platform = get_runtime_platform()\n    wrapper_name = \"copilot-runtime.exe\" if sys.platform == \"win32\" else \"copilot-runtime\"\n    pair_dir = get_cache_dir(ver) / \"prebuilds\" / runtime_platform\n    wrapper_path = pair_dir / wrapper_name\n    runtime_path = pair_dir / \"runtime.node\"\n    assets_marker = pair_dir / _HOSTLESS_ASSETS_MARKER","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/python/copilot/_cli_download.py#L295-L331","documentation":"When extracting a runtime package member, archive.extractfile() returned None despite the member passing the isfile check, so its bytes cannot be read. This is treated as a fatal extraction error since the runtime bundle would be silently incomplete.","triggerScenarios":"A tar member reports isfile() but its data stream cannot be opened — typically corrupt/truncated archives or exotic member metadata that tarfile cannot materialize.","commonSituations":"Interrupted or corrupted downloads (rare, since checksums are verified first); very large members with stream issues; malformed tar metadata.","solutions":["Delete the cached download and retry so the archive is fetched fresh.","Verify the archive integrity manually (gzip -t, tar -tf).","Check available disk space and memory for the extraction destination.","Report the release if corruption reproduces from the official source."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"import gzip\ngzip.open(\"pkg.tgz\").close()  # raises on corruption before extraction","typeGuard":null,"tryCatchPattern":"import shutil\ntry:\n    ensure_runtime_wrapper()\nexcept RuntimeError as e:\n    if \"Failed to read runtime package entry\" in str(e):\n        clear_cache(); ensure_runtime_wrapper(force=True)\n    else:\n        raise","preventionTips":["Ensure adequate disk space before provisioning.","Retry with a fresh download on corruption errors.","Monitor for repeated failures that indicate flaky storage/network."],"tags":["archive-extraction","corruption","file-read"],"backgroundTag":"file-read-failed","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}