github/copilot-sdk · error · IOException

PT_INTERP extends past probe window; increase probe size

Error message

PT_INTERP extends past probe window; increase probe size

What it means

The PT_INTERP segment (p_offset + p_filesz) must lie entirely within the bytes probed from the file, because the interpreter path string is read from the probe. If the segment extends past the probe window, the probe is too small and an IOException is thrown telling the caller to enlarge it.

Solutions

  1. Increase the probe size (e.g. 4–64 KiB, or min(fileSize, 1MiB)) so the whole PT_INTERP segment is captured.
  2. Fall back to reading the entire file when the head probe fails this check.
  3. Verify the file is complete: compare size and checksum against the published artifact.
  4. Extract the interpreter with `readelf -l <path> | grep interpreter` to confirm the path length and roughly where it sits in the file.

Example fix

// before
byte[] probe = new byte[256];
readFully(path, probe);
// after
long fileSize = Files.size(path);
byte[] probe = readHead(path, (int) Math.min(fileSize, 65536));
Defensive patterns

Strategy: try-catch

Validate before calling

long fileSize = Files.size(path);
byte[] probe = readHead(path, (int) Math.min(fileSize, 1 << 20)); // generous head read

Try / catch

try {
    String interp = readElfPtInterp(probe);
} catch (IOException e) {
    if (e.getMessage().contains("probe window")) {
        probe = Files.readAllBytes(path);          // retry with full file
        interp = readElfPtInterp(probe);
    } else throw e;
}

Prevention

When it happens

Trigger: The probe covers the ELF header but not the full PT_INTERP segment — common when the interpreter path (.interp section content, e.g. long glibc paths) sits at a file offset beyond the probe size, or the read was truncated.

Common situations: Binaries with long interpreter paths (e.g. custom glibc under /opt/...) located late in the file combined with a small fixed probe size; head-only reads of large binaries; partial downloads.

Understand the failure class

Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.

Related errors


AI-assisted analysis of github/copilot-sdk@cd8cf15dc3 (2026-09-09). Data as JSON: /api/errors/7a02574f55f075d9. Report an issue: GitHub.

Appendix: source

Thrown at java/sdk/src/main/java/com/github/copilot/ffi/PlatformDetector.java:237

            long pOffset;
            long pFileSize;
            if (elfClass == ELF_CLASS_64) {
                pOffset = readUInt64(probe, base + 8, littleEndian);
                pFileSize = readUInt64(probe, base + 32, littleEndian);
            } else {
                pOffset = readUInt32(probe, base + 4, littleEndian);
                pFileSize = readUInt32(probe, base + 16, littleEndian);
            }

            if (pOffset < 0 || pFileSize <= 0 || pOffset > Integer.MAX_VALUE || pFileSize > Integer.MAX_VALUE) {
                throw new IOException("Invalid PT_INTERP bounds");
            }

            int start = (int) pOffset;
            int end = start + (int) pFileSize;
            if (end > size) {
                throw new IOException("PT_INTERP extends past probe window; increase probe size");
            }

            int nulIndex = start;
            while (nulIndex < end && probe[nulIndex] != 0) {
                nulIndex++;
            }
            if (nulIndex == start) {
                throw new IOException("Empty PT_INTERP segment");
            }
            return new String(probe, start, nulIndex - start, StandardCharsets.UTF_8);
        }

        throw new IOException("ELF PT_INTERP segment not found");
    }

    private static byte[] readPrefix(Path path, int maxBytes) throws IOException {
        byte[] buffer = new byte[maxBytes];
        int total = 0;

View on GitHub (pinned to cd8cf15dc3)