{"record":{"id":"6ec528f6b6ba2795","repo":"github/copilot-sdk","slug":"copilot-runtime-wrapper-and-runtime-node-must-both","errorCode":null,"errorMessage":"Copilot runtime wrapper and runtime.node must both be non-empty.","messagePattern":"Copilot runtime wrapper and runtime\\.node must both be non-empty\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/copilot/_cli_download.py","lineNumber":363,"sourceCode":"            \"and automatic downloads are disabled.\"\n        )\n\n    data = _fetch_verified_release_package(ver, runtime_platform)\n    import shutil\n\n    pair_dir.parent.mkdir(parents=True, exist_ok=True)\n    staging_dir = Path(tempfile.mkdtemp(dir=pair_dir.parent, prefix=\".runtime-bundle-\"))\n    try:\n        _materialize_runtime_bundle(data, runtime_platform, staging_dir)\n        staged_wrapper = staging_dir / wrapper_name\n        staged_runtime = staging_dir / \"runtime.node\"\n        if (\n            not staged_wrapper.is_file()\n            or staged_wrapper.stat().st_size == 0\n            or not staged_runtime.is_file()\n            or staged_runtime.stat().st_size == 0\n        ):\n            raise RuntimeError(\"Copilot runtime wrapper and runtime.node must both be non-empty.\")\n        if sys.platform != \"win32\":\n            staged_wrapper.chmod(\n                staged_wrapper.stat().st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH\n            )\n        (staging_dir / assets_marker.name).write_text(\"1\\n\", encoding=\"ascii\")\n        try:\n            if pair_dir.exists() and (force or not assets_marker.is_file()):\n                shutil.rmtree(pair_dir, ignore_errors=True)\n            staging_dir.replace(pair_dir)\n        except OSError:\n            if (\n                wrapper_path.is_file()\n                and wrapper_path.stat().st_size > 0\n                and runtime_path.is_file()\n                and runtime_path.stat().st_size > 0\n                and assets_marker.is_file()\n            ):\n                return str(wrapper_path)","sourceCodeStart":345,"sourceCodeEnd":381,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/python/copilot/_cli_download.py#L345-L381","documentation":"Raised by ensure_runtime_wrapper after staging the Copilot runtime: the wrapper script and the native runtime.node binary must both exist as files and have a non-zero size before the staging directory is finalized and made executable. The library throws this to prevent promoting a corrupted or incomplete runtime download into the cache.","triggerScenarios":"Calling download_cli(), ensure_runtime_library(), main(), or the runtime entrypoint resolvers when a staged download produced an empty or missing wrapper/runtime.node file (e.g. truncated download, interrupted copy, or disk full).","commonSituations":"Network outage mid-download leaving zero-byte files; antivirus or disk-quota stripping the staged runtime.node; a corrupted package cache being re-staged.","solutions":["Delete the Copilot CLI/runtime cache directory so the runtime is re-downloaded from scratch.","Re-run the download (download_cli / main) on a stable network connection and confirm disk space is available.","Check antivirus/quota software for interference with large binary files in the cache path.","If it persists, verify the release assets themselves are intact (asset names/checksums) for your platform."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from pathlib import Path\nwrapper, runtime = Path(staged_wrapper), Path(staged_runtime)\nif not (wrapper.is_file() and runtime.is_file() and wrapper.stat().st_size > 0 and runtime.stat().st_size > 0):\n    raise RuntimeError(\"staged runtime assets incomplete; re-download\")","typeGuard":null,"tryCatchPattern":"try:\n    ensure_runtime_wrapper(...)\nexcept RuntimeError as e:\n    if \"non-empty\" in str(e):\n        clear_cache_and_redownload()","preventionTips":["Ensure stable network and adequate disk space before downloading the runtime.","Exclude cache directories from antivirus scanning.","Verify staged files exist and are non-empty before promoting them."],"tags":["runtime","download","corrupt-install"],"backgroundTag":"empty-required-field","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}