{"record":{"id":"77a41ec25b08ad7d","repo":"apache/druid","slug":"unknown-version-d-77a41e","errorCode":null,"errorMessage":"Unknown version[%d]","messagePattern":"Unknown version\\[(.+?)\\]","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/segment/IndexIO.java","lineNumber":349,"sourceCode":"    return new SegmentValidationException(\"Dim [%s] values not equal. Expected %s found %s\", dimName, v1, v2);\n  }\n\n  public static class DefaultIndexIOHandler implements IndexIOHandler\n  {\n    private static final Logger log = new Logger(DefaultIndexIOHandler.class);\n\n    @Override\n    public MMappedIndex mapDir(File inDir) throws IOException\n    {\n      log.debug(\"Mapping v8 index[%s]\", inDir);\n      long startTime = System.currentTimeMillis();\n\n      InputStream indexIn = null;\n      try {\n        indexIn = new FileInputStream(new File(inDir, \"index.drd\"));\n        byte theVersion = (byte) indexIn.read();\n        if (theVersion != V8_VERSION) {\n          throw new IAE(\"Unknown version[%d]\", theVersion);\n        }\n      }\n      finally {\n        Closeables.close(indexIn, false);\n      }\n\n      SmooshedFileMapper smooshedFiles = Smoosh.map(inDir);\n      ByteBuffer indexBuffer = smooshedFiles.mapFile(\"index.drd\");\n\n      indexBuffer.get(); // Skip the version byte\n      final GenericIndexed<String> availableDimensions = GenericIndexed.read(\n          indexBuffer,\n          GenericIndexed.STRING_STRATEGY,\n          smooshedFiles\n      );\n      final GenericIndexed<String> availableMetrics = GenericIndexed.read(\n          indexBuffer,\n          GenericIndexed.STRING_STRATEGY,","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/segment/IndexIO.java#L331-L367","documentation":"IndexIO.mapDir (the legacy v8 segment loader) reads the first byte of index.drd and only accepts V8_VERSION. Any other byte means the directory is not a v8 index or is corrupt, so it throws IAE. Note the check compares to V8_VERSION although the similar v9 loader messages say version 9 — for this v8 path any non-v8 version byte is rejected.","triggerScenarios":"Calling IndexIO.mapDir on a directory whose index.drd first byte is not the v8 version constant — e.g. pointing the legacy loader at a v9 segment directory, or at a truncated/corrupt index.drd (read() returning -1).","commonSituations":"Loading old deep-stored segments with the wrong IndexIO handler; manually unzipped/moved segment directories where index.drd is empty or from a newer format; custom tooling that walks segment dirs without checking version.bin first.","solutions":["Verify the segment version via version.bin / SegmentUtils and route v9 segments to the v9 loader (IndexIO.DefaultMapper) instead of mapDir","Re-download or re-unzip the segment — index.drd may be truncated or empty","Convert the segment to the format your loader expects using IndexMerger"],"exampleFix":"// before\nMMappedIndex idx = indexIO.mapDir(segmentDir); // fails on v9 dirs\n// after\nint version = Ints.fromByteArray(Files.toByteArray(new File(segmentDir, \"version.bin\")));\nMMappedIndex idx = (version == IndexIO.V8_VERSION)\n    ? indexIO.mapDir(segmentDir)\n    : indexIO.mapDir(segmentDir, segmentDir, segmentDir); // v9 path","handlingStrategy":"try-catch","validationCode":"try (InputStream in = new FileInputStream(new File(dir, \"index.drd\"))) {\n  byte v = (byte) in.read();\n  if (v != IndexIO.V8_VERSION) {\n    throw new IllegalStateException(\"Not a v8 segment (version byte \" + v + \")\");\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  MMappedIndex idx = indexIO.mapDir(inDir);\n} catch (IAE e) {\n  if (e.getMessage().startsWith(\"Unknown version\")) {\n    // fall back to the v9 loader or fail with a clear message\n  }\n}","preventionTips":["Check version.bin before choosing a segment loader","Never assume segment format when reading from deep storage; inspect metadata first","Re-download segments whose index.drd may be truncated"],"tags":["druid","segment","version","unsupported-format"],"backgroundTag":"unsupported-enum-value","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}