{"record":{"id":"0940b1c8766f6362","repo":"github/copilot-sdk","slug":"published-runtime-wrapper-is-not-a-non-empty-execu","errorCode":null,"errorMessage":"Published runtime wrapper is not a non-empty executable file: ","messagePattern":"Published runtime wrapper is not a non-empty executable file: ","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"java/sdk/src/main/java/com/github/copilot/ffi/NativeRuntimeLoader.java","lineNumber":215,"sourceCode":"        }\n\n        String resourcePath = \"native/\" + classifier + \"/\" + wrapperName;\n        URL resource = loader.getResource(resourcePath);\n        if (resource == null) {\n            throw new FileNotFoundException(\"Runtime wrapper not found on classpath: \" + resourcePath\n                    + \" — add the matching classifier JAR to the classpath\");\n        }\n\n        Path temp = Files.createTempFile(cacheDir, \"runtime-wrapper-tmp-\", \"\");\n        try {\n            copyResourceToTemp(resource, resourcePath, temp);\n            makeExecutable(temp);\n            DEFAULT_PUBLISHER.publish(temp, cachedWrapper);\n        } finally {\n            tryDelete(temp);\n        }\n        if (!isValidCachedCli(cachedWrapper)) {\n            throw new IOException(\"Published runtime wrapper is not a non-empty executable file: \" + cachedWrapper);\n        }\n        return cachedWrapper;\n    }\n\n    static Path resolveEntrypoint(String configuredCli, Path runtimePath) throws IOException {\n        if (configuredCli != null && !configuredCli.isBlank()) {\n            Path configuredPath = Path.of(configuredCli).toAbsolutePath().normalize();\n            if (resolveFromCliPath(configuredCli) != null && Files.isRegularFile(configuredPath)\n                    && Files.size(configuredPath) > 0) {\n                return configuredPath;\n            }\n        }\n\n        Path parent = runtimePath.getParent();\n        String cliName = isWindows() ? CLI_FILENAME_WINDOWS : CLI_FILENAME;\n        Path cliPath = parent.resolve(cliName);\n        if (Files.isRegularFile(cliPath) && Files.size(cliPath) > 0) {\n            return cliPath;","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/java/sdk/src/main/java/com/github/copilot/ffi/NativeRuntimeLoader.java#L197-L233","documentation":"After copying the runtime wrapper to a temp file and atomically publishing it into the cache, the loader re-validates the published file (non-empty, regular, executable) and it fails. This indicates the publish produced a corrupt or unusable file rather than a clean extraction.","triggerScenarios":"A concurrent publisher replaced cachedWrapper with a truncated/empty file between publish and validation; the cache directory filesystem doesn't preserve the executable bit; disk-full or permission issue corrupted the moved file.","commonSituations":"Shared NFS/network home directories without reliable atomic move semantics; concurrent app instances racing on ~/.copilot/runtime-cache; security software stripping the execute bit after extraction; read-only or quota-exceeded cache directory.","solutions":["Clear the runtime cache (rm -rf ~/.copilot/runtime-cache) and retry resolution.","Ensure the cache directory is on a local filesystem that supports atomic moves and POSIX permissions (avoid NFS homes).","Run only one instance at a time or serialize first startup; then restart to re-extract.","Check that no antivirus/cleanup daemon is deleting or chmod'ing files under ~/.copilot/runtime-cache."],"exampleFix":"// before\nPath wrapper = NativeRuntimeLoader.resolveRuntimeWrapper();\n\n// after: validate cache and clear it if the wrapper is unusable\nPath wrapper;\ntry {\n    wrapper = NativeRuntimeLoader.resolveRuntimeWrapper();\n} catch (IOException e) {\n    Files.walkFileTree(Path.of(System.getProperty(\"user.home\"), \".copilot\", \"runtime-cache\"),\n        new SimpleFileVisitor<>() { public FileVisitResult visitFile(Path f, BasicFileAttributes a) throws IOException { Files.delete(f); return FileVisitResult.CONTINUE; } });\n    wrapper = NativeRuntimeLoader.resolveRuntimeWrapper();\n}","handlingStrategy":"retry","validationCode":"Path wrapper = Path.of(System.getProperty(\"user.home\"), \".copilot\", \"runtime-cache\")\n    // walk to wrapper once resolved; precheck: existing wrapper must be non-empty and executable\nboolean ok = Files.isRegularFile(p) && Files.size(p) > 0 && (isWindows() || Files.isExecutable(p));\n","typeGuard":null,"tryCatchPattern":"try {\n    Path wrapper = NativeRuntimeLoader.resolveRuntimeWrapper();\n} catch (IOException e) {\n    if (e.getMessage().startsWith(\"Published runtime wrapper\")) {\n        deleteRuntimeCache();\n        wrapper = NativeRuntimeLoader.resolveRuntimeWrapper();\n    } else throw e;\n}","preventionTips":["Keep ~/.copilot/runtime-cache on a local, POSIX-capable filesystem.","Don't run multiple instances on a cold shared cache concurrently.","Exclude the cache directory from antivirus/cleanup jobs.","Monitor disk space and permissions in the home directory."],"tags":["native-loader","filesystem","cache","permissions"],"backgroundTag":"invalid-state-transition","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"}