{"record":{"id":"b76cb015307fc23e","repo":"github/copilot-sdk","slug":"copilot-runtime-wrapper-and-adjacent-runtime-node","errorCode":null,"errorMessage":"Copilot runtime wrapper and adjacent runtime.node must both be non-empty.","messagePattern":"Copilot runtime wrapper and adjacent runtime\\.node must both be non-empty\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Client.cs","lineNumber":2511,"sourceCode":"        }\n        return ValidateRuntimePair(searchedWrapper, \"Bundled runtime\");\n    }\n\n    private static RuntimeLaunch ValidateRuntimePair(string wrapper, string source)\n    {\n        var runtimeNode = Path.Combine(Path.GetDirectoryName(Path.GetFullPath(wrapper))!, \"runtime.node\");\n        if (!File.Exists(wrapper))\n        {\n            throw new InvalidOperationException($\"Copilot runtime wrapper not found at '{wrapper}'.\");\n        }\n        if (!File.Exists(runtimeNode))\n        {\n            throw new InvalidOperationException(\n                $\"Copilot runtime wrapper at '{wrapper}' is missing its adjacent runtime.node at '{runtimeNode}'.\");\n        }\n        if (new FileInfo(wrapper).Length == 0 || new FileInfo(runtimeNode).Length == 0)\n        {\n            throw new InvalidOperationException(\"Copilot runtime wrapper and adjacent runtime.node must both be non-empty.\");\n        }\n#if NET8_0_OR_GREATER\n        if (!OperatingSystem.IsWindows())\n        {\n            var mode = File.GetUnixFileMode(wrapper);\n            const UnixFileMode executeBits =\n                UnixFileMode.UserExecute | UnixFileMode.GroupExecute | UnixFileMode.OtherExecute;\n            if ((mode & executeBits) == 0)\n            {\n                File.SetUnixFileMode(wrapper, mode | executeBits);\n            }\n        }\n#endif\n        return new RuntimeLaunch(wrapper, source);\n    }\n\n    private sealed record RuntimeLaunch(string Executable, string Source);\n","sourceCodeStart":2493,"sourceCodeEnd":2529,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/dotnet/src/Client.cs#L2493-L2529","documentation":"Both the runtime wrapper and its adjacent runtime.node exist, but at least one of them is a zero-byte file. An empty wrapper or native module is corrupt (failed download/copy), so the client throws instead of attempting a doomed launch.","triggerScenarios":"new FileInfo(wrapper).Length == 0 || new FileInfo(runtimeNode).Length == 0 at Client.cs:2511 during ValidateRuntimePair.","commonSituations":"Interrupted download or copy that left a 0-byte file; disk-full during build/publish; a git LFS or packaging step that replaced the binary with a placeholder; filesystem corruption after a crash.","solutions":["Delete the empty file(s) and reinstall/redownload the runtime package so both files are non-empty.","Re-run the build/publish step that copies the runtime assets, checking for disk-space errors.","Verify file sizes on disk (`ls -l`) before launching; restore the real binary if LFS placeholders were committed.","Add an integrity check (size/hash) to your deployment pipeline for native runtime assets."],"exampleFix":"// before: zero-byte runtime.node from a failed copy\nFile.Copy(srcWrapper, destWrapper); // runtime.node copy failed silently\n\n// after: copy both and validate\nFile.Copy(srcWrapper, destWrapper, overwrite: true);\nFile.Copy(srcRuntimeNode, destRuntimeNode, overwrite: true);\nif (new FileInfo(destRuntimeNode).Length == 0) throw new IOException(\"runtime.node copy produced an empty file\");","handlingStrategy":"validation","validationCode":"var w = new FileInfo(options.WrapperPath!);\nvar n = new FileInfo(Path.Combine(w.DirectoryName!, \"runtime.node\"));\nif (w.Length == 0 || n.Length == 0)\n    throw new IOException(\"Runtime wrapper/runtime.node must both be non-empty; reinstall the runtime\");","typeGuard":"static bool RuntimeAssetsValid(string? wrapper) =>\n    wrapper is { Length: > 0 } && File.Exists(wrapper) &&\n    new FileInfo(wrapper).Length > 0 &&\n    File.Exists(Path.Combine(Path.GetDirectoryName(Path.GetFullPath(wrapper))!, \"runtime.node\")) &&\n    new FileInfo(Path.Combine(Path.GetDirectoryName(Path.GetFullPath(wrapper))!, \"runtime.node\")).Length > 0;","tryCatchPattern":"try\n{\n    await client.StartAsync();\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"must both be non-empty\"))\n{\n    logger.LogError(ex, \"Zero-byte runtime asset detected; reinstall the Copilot runtime\");\n}","preventionTips":["Check for disk-full/interrupted-copy errors during build and publish.","Restore real binaries when git LFS placeholders appear.","Add file-size or hash verification to the deployment pipeline."],"tags":["corrupt-file","runtime","empty-file","packaging"],"backgroundTag":"corrupt-file","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}