{"record":{"id":"fe60f1853bc67a9b","repo":"apache/druid","slug":"unknown-encoding-strategy-s","errorCode":null,"errorMessage":"Unknown encoding strategy: %s","messagePattern":"Unknown encoding strategy: (.+?)","errorType":"exception","errorClass":"ISE","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/segment/column/StringEncodingStrategies.java","lineNumber":68,"sourceCode":"    // write plain utf8 in the legacy format, where generic indexed was written directly\n    if (StringEncodingStrategy.UTF8.equals(encodingStrategy.getType())) {\n      return new GenericIndexedWriter<>(writeoutMedium, fileName, GenericIndexed.STRING_STRATEGY);\n    } else {\n      // otherwise, we wrap in an EncodedStringDictionaryWriter so that we write a small header that includes\n      // a version byte that should hopefully never conflict with a GenericIndexed version, along with a byte\n      // from StringEncodingStrategy.getId to indicate which encoding strategy is used for the dictionary before\n      // writing the dictionary itself\n      DictionaryWriter<byte[]> writer;\n      if (StringEncodingStrategy.FRONT_CODED.equals(encodingStrategy.getType())) {\n        StringEncodingStrategy.FrontCoded strategy = (StringEncodingStrategy.FrontCoded) encodingStrategy;\n        writer = new FrontCodedIndexedWriter(\n            writeoutMedium,\n            IndexIO.BYTE_ORDER,\n            strategy.getBucketSize(),\n            strategy.getFormatVersion()\n        );\n      } else {\n        throw new ISE(\"Unknown encoding strategy: %s\", encodingStrategy.getType());\n      }\n      return new EncodedStringDictionaryWriter(writer, encodingStrategy);\n    }\n  }\n\n  public static Supplier<? extends Indexed<ByteBuffer>> getStringDictionarySupplier(\n      SegmentFileMapper mapper,\n      ByteBuffer stringDictionaryBuffer,\n      ByteOrder byteOrder\n  )\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(","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/segment/column/StringEncodingStrategies.java#L50-L86","documentation":"StringEncodingStrategies.getStringDictionaryWriter() selects the writer implementation based on the configured StringEncodingStrategy type (utf8, front-coded, etc.). This ISE is thrown when the strategy's getType() is not one of the known encoding types, so no dictionary writer can be constructed for segment output.","triggerScenarios":"Calling getStringDictionaryWriter() with a StringEncodingStrategy whose getType() is an unknown/unregistered constant — typically a custom or future encoding strategy type supplied via column format configuration while writing a string dictionary.","commonSituations":"Typo or invalid value in a custom column format/encoding strategy configuration; running a segment-writing build older than the strategy type being requested (version skew); a custom extension returning an unrecognized strategy type.","solutions":["Use one of the supported encoding strategies (e.g. Utf8 or FrontCoded) in the column format spec","Upgrade the Druid build so it recognizes the requested encoding strategy type","If a custom strategy was added, register a writer branch for its type in StringEncodingStrategies"],"exampleFix":"// before\n\"stringDictionaryEncoding\": { \"type\": \"frontcoded-x\" } // unknown type\n// after\n\"stringDictionaryEncoding\": { \"type\": \"front-coded\", \"bucketSize\": 16 } // supported strategy","handlingStrategy":"validation","validationCode":"if (!EnumSet.of(StringEncodingStrategy.Utf8.TYPE, StringEncodingStrategy.FrontCoded.TYPE).contains(encodingStrategy.getType())) {\n  throw new IllegalArgumentException(\"Unsupported encoding strategy: \" + encodingStrategy.getType());\n}","typeGuard":"boolean hasWriter(StringEncodingStrategy s) {\n  return \"utf8\".equals(s.getType()) || \"front-coded\".equals(s.getType());\n}","tryCatchPattern":"try {\n  writer = StringEncodingStrategies.getStringDictionaryWriter(strategy, buffer, writeoutMedium);\n} catch (ISE e) {\n  LOG.warn(e, \"Unknown encoding strategy [%s], falling back to utf8\", strategy.getType());\n  writer = StringEncodingStrategies.getStringDictionaryWriter(new StringEncodingStrategy.Utf8(), buffer, writeoutMedium);\n}","preventionTips":["Only configure encoding types supported by the deployed Druid version","Validate column format spec fields against the enum of known strategy types","Avoid custom strategy types unless you also register a writer"],"tags":["java","encoding-strategy","segment-write","invalid-enum-value"],"backgroundTag":"invalid-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"}