apache/druid · error · RE

Failed to read data for

Error message

Failed to read data for [%s]

What it means

CompressedNestedDataComplexColumn's field-reading code wraps IOExceptions from reading compressed dictionaries, bitmaps, or value data into RE 'Failed to read data for [%s]'. It means the nested field's on-disk data could not be read/deserialized.

Solutions

  1. Re-download the segment from deep storage to replace truncated files
  2. Check underlying disk/NFS health for I/O errors
  3. Confirm writer/reader Druid version compatibility for nested columns
  4. Re-ingest the segment if data is corrupt

Example fix

// before
// failing repeatedly on corrupt field file
ColumnHolder c = columnBuilder.build();
// after
try { c = columnBuilder.build(); } catch (RE e) { cache.drop(segmentId); /* refetch */ throw e; }
Defensive patterns

Strategy: try-catch

Validate before calling

try (InputStream in = openFieldFile(fieldFileName)) { /* read fully to validate before handing to column */ byte[] all = in.readAllBytes(); if (all.length < expectedMinBytes) throw new IOException("truncated field file"); }

Type guard

boolean fieldFileReadable(File f) { return f != null && f.isFile() && f.length() > 0 && f.canRead(); }

Try / catch

try { col = buildColumn(...); } catch (RE e) { log.error(e, "Failed reading nested field %s", field); cacheCleaner.cleanup(segmentDir); throw e; }

Prevention

When it happens

Trigger: Constructing the column (loadField path) when reading any nested field file raises IOException — truncated files, corrupt compression blocks, or unreadable mmap regions.

Common situations: Truncated segment files from failed deep-storage download; disk/NFS I/O errors; incompatible segment format from a different writer version.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


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

Appendix: source

Thrown at processing/src/main/java/org/apache/druid/segment/nested/CompressedNestedDataComplexColumn.java:1230

        throw DruidException.defensive("Unsupported BitmapIndexType[%s]", indexType);
      }

      columnBuilder.setDictionaryEncodedColumnSupplier(() -> closer.register(new NestedFieldDictionaryEncodedColumn(
          types,
          longs.get(),
          doubles.get(),
          ints.get(),
          stringDictionarySupplier.get(),
          longDictionarySupplier.get(),
          doubleDictionarySupplier.get(),
          arrayDictionarySupplier != null ? arrayDictionarySupplier.get() : null,
          localDictionarySupplier.get(),
          nullBitmap
      )));
      return columnBuilder.build();
    }
    catch (IOException ex) {
      throw new RE(ex, "Failed to read data for [%s]", field);
    }
  }

  private static final class IntTypeStrategy implements TypeStrategy<Integer>
  {
    @Override
    public int estimateSizeBytes(Integer value)
    {
      return Integer.BYTES;
    }

    @Override
    public Integer read(ByteBuffer buffer)
    {
      return buffer.getInt();
    }

    @Override

View on GitHub (pinned to 9b90983fd2)