github/copilot-sdk · error · IOException
Invalid runtime asset mode in
Error message
Invalid runtime asset mode in
What it means
Inventory lines encode the asset's file mode as an octal integer parsed with Integer.parseInt(fields[0], 8). If that field is not a valid octal number (e.g. '9xx', letters, empty), a NumberFormatException is caught and rethrown as this IOException naming the inventory resource. It signals a malformed or corrupted inventory file, not a problem with the local environment.
Solutions
- Fix the inventory resource so every mode field is a valid octal literal (e.g. 644, 755).
- Replace the corrupted/mismatched artifact jar with an intact official build.
- If generating inventories yourself, write modes with Integer.toOctalString(mode) and parse with radix 8.
Example fix
// before (inventory line) rwxr-xr-x bin/cli // after 755 bin/cli
Defensive patterns
Strategy: validation
Validate before calling
// Java: pre-scan inventory mode fields for octal validity before extraction
for (String line : inventoryLines) {
String mode = line.split(" ", 2)[0];
Integer.parseInt(mode, 8); // throws NumberFormatException on bad mode
} Try / catch
try { loader.loadRuntime(); } catch (IOException e) { if (e.getMessage().startsWith("Invalid runtime asset mode in")) { // artifact is malformed: replace jar, do not retry } else throw e; } Prevention
- Use official release artifacts; don't regenerate inventories with custom scripts
- If generating inventories, always emit modes via Integer.toOctalString
- Verify artifact checksums after download
When it happens
Trigger: An inventory line whose mode field cannot be parsed in base 8 — e.g. '999 file', '0x1ed file', 'rwx file', or an empty mode field.
Common situations: Hand-edited or tool-generated inventory using decimal or symbolic ('rwxr-xr-x') modes instead of octal; corrupted jar contents; a new inventory format written by a mismatched library version.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- Unexpected trailing content at position
- Unescaped control character at position <pos-1>
- Unterminated string escape at position
- Invalid escape sequence \
- Incomplete Unicode escape at position <pos-2>
AI-assisted analysis of github/copilot-sdk@cd8cf15dc3 (2026-09-09).
Data as JSON: /api/errors/9316a2c49cddf3f3.
Report an issue: GitHub.
Appendix: source
Thrown at java/sdk/src/main/java/com/github/copilot/ffi/NativeRuntimeLoader.java:489
String resourcePath = "native/" + classifier + "/" + fields[1];
URL resource = loader.getResource(resourcePath);
if (resource == null) {
throw new FileNotFoundException("Runtime asset not found on classpath: " + resourcePath);
}
Files.createDirectories(cached.getParent());
Path temp = Files.createTempFile(cached.getParent(), "runtime-asset-tmp-", "");
try {
copyResourceToTemp(resource, resourcePath, temp);
if (executable) {
makeExecutable(temp);
}
publisher.publish(temp, cached);
} finally {
tryDelete(temp);
}
}
} catch (NumberFormatException ex) {
throw new IOException("Invalid runtime asset mode in " + inventoryResourcePath, ex);
}
}
/**
* Extracts the copilot CLI executable from the classpath to the same cache
* directory as {@code runtime.node}. Idempotent — skips extraction if already
* present and valid.
*/
static void extractCliToCache(Path cacheDir, ClassLoader loader, String classifier, AtomicPublisher publisher)
throws IOException {
String cliName = isWindows() ? CLI_FILENAME_WINDOWS : CLI_FILENAME;
String cliResourcePath = "native/" + classifier + "/" + cliName;
Path cachedCli = cacheDir.resolve(cliName);
if (isValidCachedCli(cachedCli)) {
return;
}
View on GitHub (pinned to cd8cf15dc3)