apache/druid · error · org.apache.druid.java.util.common.ISE
Value dictionaries already serialized for column
Error message
Value dictionaries already serialized for column [%s], cannot serialize again
What it means
serializeDictionaries writes the null sentinel plus string/long/double/arrays dictionaries for a variant column and can only run once per serializer instance. If dictionarySerialized is already true, calling it again would corrupt the column, so it throws ISE 'Value dictionaries already serialized ... cannot serialize again'.
Solutions
- Ensure serializeDictionaries is called exactly once per serializer instance
- Use a fresh VariantColumnSerializer if dictionaries must be rewritten
- Make retry wrappers idempotent or recreate the serializer on retry
- Track serialization state in the calling merge code
Example fix
// before
if (needsRetry) serializer.serializeDictionaries(...); // second call
// after
if (needsRetry) { serializer = createNewSerializer(name, medium); serializer.serializeDictionaries(...); } Defensive patterns
Strategy: validation
Validate before calling
if (serializer.isDictionarySerialized()) { throw new IllegalStateException("dictionaries already written for " + name); } Try / catch
try { serializer.serializeDictionaries(strings, longs, doubles, arrays); } catch (ISE e) { if (e.getMessage().startsWith("Value dictionaries already serialized")) { /* skip second call */ } else { throw e; } } Prevention
- Call serializeDictionaries exactly once per serializer
- Make retry logic recreate the serializer instead of re-calling
- Keep dictionary and value phases in one code path
When it happens
Trigger: Calling serializeDictionaries twice on the same VariantColumnSerializer, e.g. retry logic that re-invokes the method after a partial failure, or a merge path that processes dictionaries per-part and per-column.
Common situations: Custom segment merge tooling with retriable dictionary serialization; adding dictionary handling code to an existing merge pipeline without tracking state.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- Dictionary not serialized, cannot open value serializer
- Must serialize value dictionaries before serializing values…
- Already started.
- Already started, not starting again
- can't stop.
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/02ad053cd18b8b6a.
Report an issue: GitHub.
Appendix: source
Thrown at processing/src/main/java/org/apache/druid/segment/nested/VariantColumnSerializer.java:201
public void open() throws IOException
{
if (!dictionarySerialized) {
throw new IllegalStateException("Dictionary not serialized, cannot open value serializer");
}
intermediateValueWriter = new FixedIndexedIntWriter(segmentWriteOutMedium, false);
intermediateValueWriter.open();
}
@Override
public void serializeDictionaries(
Iterable<String> strings,
Iterable<Long> longs,
Iterable<Double> doubles,
Iterable<int[]> arrays
) throws IOException
{
if (dictionarySerialized) {
throw new ISE("Value dictionaries already serialized for column [%s], cannot serialize again", name);
}
// null is always 0
dictionaryWriter.write(null);
for (String value : strings) {
if (value == null) {
continue;
}
dictionaryWriter.write(value);
}
for (Long value : longs) {
if (value == null) {
continue;
}
longDictionaryWriter.write(value);
}View on GitHub (pinned to 9b90983fd2)