apache/druid · error · org.apache.druid.java.util.common.IAE

Unknown id [ ]

Error message

Unknown id [%s]

What it means

VariantColumn.lookupId translates a dictionary-encoded integer id back to a typed value (string, long, or double) by subtracting per-type offsets. An id that falls outside all three sub-dictionary ranges is invalid for this column, so the column throws IAE 'Unknown id'. This indicates a corrupted id or a dictionary/id mismatch in the segment.

Solutions

  1. Re-ingenerate the affected segment by re-running ingestion for the affected time chunk
  2. Validate the segment's dictionary files (smoosh files) for corruption
  3. Check for concurrent overwrite/append operations that may have replaced the segment mid-query
  4. Upgrade Druid; some nested-column dictionary bugs were fixed in later releases

Example fix

// before
Object value = indexed.get(badId);
// after
if (badId >= 0 && badId < indexed.size()) { Object value = indexed.get(badId); }
Defensive patterns

Strategy: validation

Validate before calling

if (id < 0 || id >= indexed.size()) { throw new IllegalArgumentException("id out of dictionary range: " + id); }

Type guard

static boolean isValidId(int id, int size) { return id >= 0 && id < size; }

Try / catch

try { Object v = indexed.get(id); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith("Unknown id")) { /* treat as corrupted segment; mark for reingest */ } else { throw e; } }

Prevention

When it happens

Trigger: Calling lookupId (via the Indexed accessor's next/get) with an id >= stringDictionary.size() + longDictionary.size() + doubleDictionary.size(), typically from a corrupted forward dictionary or stale index in a V1 nested segment.

Common situations: Reading a segment written by a buggy or older writer; manual segment manipulation or partial segment uploads; bitmap/index bitmaps referencing ids that no longer exist after a dictionary rebuild.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/b68e330faea33aac. Report an issue: GitHub.

Appendix: source

Thrown at processing/src/main/java/org/apache/druid/segment/nested/VariantColumn.java:210

        return nextArray;
      }

      @Nullable
      private Object lookupId(int id)
      {
        if (id == 0) {
          return null;
        }
        final int adjustLongId = stringDictionary.size();
        final int adjustDoubleId = stringDictionary.size() + longDictionary.size();
        if (id < adjustLongId) {
          return StringUtils.fromUtf8Nullable(stringDictionary.get(id));
        } else if (id < adjustDoubleId) {
          return longDictionary.get(id - adjustLongId);
        } else if (id < adjustDoubleId + doubleDictionary.size()) {
          return doubleDictionary.get(id - adjustDoubleId);
        }
        throw new IAE("Unknown id [%s]", id);
      }
    };
    return new Indexed<>()
    {
      @Override
      public int size()
      {
        return arrayDictionary.size();
      }

      @Nullable
      @Override
      public Object[] get(int index)
      {
        throw new UnsupportedOperationException("get not supported");
      }

      @Override

View on GitHub (pinned to 9b90983fd2)