{"record":{"id":"bb147f6e1cbc4eeb","repo":"apache/druid","slug":"impossible-unknown-encoding-strategy-id-s","errorCode":null,"errorMessage":"impossible, unknown encoding strategy id: %s","messagePattern":"impossible, unknown encoding strategy id: (.+?)","errorType":"exception","errorClass":"ISE","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/segment/column/StringEncodingStrategies.java","lineNumber":96,"sourceCode":"  )\n  {\n    final int dictionaryStartPosition = stringDictionaryBuffer.position();\n    final byte dictionaryVersion = stringDictionaryBuffer.get();\n\n    if (dictionaryVersion == EncodedStringDictionaryWriter.VERSION) {\n      final byte encodingId = stringDictionaryBuffer.get();\n      if (encodingId == StringEncodingStrategy.FRONT_CODED_ID) {\n        return FrontCodedIndexed.read(\n            stringDictionaryBuffer,\n            byteOrder\n        );\n      } else if (encodingId == StringEncodingStrategy.UTF8_ID) {\n        // this cannot happen naturally right now since generic indexed is written in the 'legacy' format, but\n        // this provides backwards compatibility should we switch at some point in the future to always\n        // writing dictionaryVersion\n        return GenericIndexed.read(stringDictionaryBuffer, GenericIndexed.UTF8_STRATEGY, mapper)::singleThreaded;\n      } else {\n        throw new ISE(\"impossible, unknown encoding strategy id: %s\", encodingId);\n      }\n    } else {\n      // legacy format that only supports plain utf8 enoding stored in GenericIndexed and the byte we are reading\n      // as dictionaryVersion is actually also the GenericIndexed version, so we reset start position so the\n      // GenericIndexed version can be correctly read\n      stringDictionaryBuffer.position(dictionaryStartPosition);\n      return GenericIndexed.read(stringDictionaryBuffer, GenericIndexed.UTF8_STRATEGY, mapper)::singleThreaded;\n    }\n  }\n\n  /**\n   * Adapter to convert {@link Indexed<ByteBuffer>} with utf8 encoded bytes into {@link Indexed<String>} to be friendly\n   * to consumers.\n   */\n  public static final class Utf8ToStringIndexed implements Indexed<String>\n  {\n    private final Indexed<ByteBuffer> delegate;\n","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/segment/column/StringEncodingStrategies.java#L78-L114","documentation":"StringEncodingStrategies.getStringDictionarySupplier() reads a persisted string dictionary and dispatches on the stored encoding id (legacy, UTF8_ID, front-coded ids). This ISE is thrown when the byte-encoded encoding id read from the segment is not recognized — the dictionary on disk was written with an encoding this reader cannot decode.","triggerScenarios":"Reading a segment whose serialized dictionary header contains an encodingId unknown to this build, e.g. a segment written by a newer Druid version using an encoding id introduced after this reader, or a corrupted dictionary buffer yielding a bogus id.","commonSituations":"Version skew: newer writers produce segments that older readers cannot load; manually copied/mixed segment files across clusters; corrupted segment files on deep storage.","solutions":["Upgrade the reading Druid cluster to at least the version that wrote the segments","Restore affected segments from a backup or re-ingest the data with the current version","Verify segment file integrity (corruption can produce a bogus encoding id)"],"exampleFix":"// before\n// old cluster (e.g. 0.22) reading a segment written by 2023.x with a new front-coded encoding id\n// after\n// upgrade the old cluster so its reader recognizes the id:\n// <druid.version>2023.x</druid.version> in pom, or redeploy matching distribution","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  Supplier<? extends Indexed<ByteBuffer>> dict = StringEncodingStrategies.getStringDictionarySupplier(buffer, mapper);\n} catch (ISE e) {\n  throw new SegmentLoadingException(e, \"Segment dictionary uses an unknown encoding id — upgrade the reader or re-ingest\");\n}","preventionTips":["Upgrade the whole cluster before rolling out writer versions with new encodings","Keep segment files within one Druid-version lineage; avoid copying segments across clusters","Monitor SegmentLoadingException logs for version-skew symptoms"],"tags":["java","segment-read","encoding-strategy","version-skew"],"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-17T15:17:12.973Z"}