pentaho/pentaho-kettle · error · KettleException

AvroInputDialog.Error.KettleFileException

Error message

AvroInputDialog.Error.KettleFileException

What it means

This KettleException is thrown by AvroNestedReader.loadSchemaFromContainer when reading an Avro container file fails. The method opens the file via KettleVFS and wraps it in a DataFileStream to extract the embedded writer schema; a FileSystemException (VFS-level problem) or any other IOException (stream open/read or DataFileStream construction) is rethrown as a KettleException carrying the localized message 'AvroInputDialog.Error.KettleFileException'. The underlying cause is chained, so the real reason is in getCause().

Solutions

  1. Verify the container file exists and is readable at the exact path entered in the step dialog (ls / open it in an Avro tool).
  2. Confirm the file is a real Avro container: check it starts with the magic bytes 'Obj\u0001'; a schema-only or JSON file cannot be read this way.
  3. Read the chained cause (KettleException.getCause()) to distinguish VFS access problems from Avro parsing problems and fix accordingly.
  4. Check VFS connection settings/credentials if the file is on a remote filesystem.
  5. Re-download or regenerate the file if it is truncated or corrupt.

Example fix

// before (wrong: plain schema file passed as container)
String schemaSource = "/data/user.avsc"; // AvroSchema chosen, container path given
// after
String schemaSource = "/data/user.avro"; // actual Avro container file with embedded schema
Defensive patterns

Strategy: try-catch

Validate before calling

File f = new File(containerFilename);
if (!f.isFile() || !f.canRead()) throw new IOException("Container unreadable: " + containerFilename);
try (InputStream head = new FileInputStream(f)) {
  byte[] magic = new byte[4];
  if (head.read(magic) < 4 || magic[0] != 'O' || magic[1] != 'b' || magic[2] != 'j')
    throw new IOException("Not an Avro container file");
}

Type guard

static boolean isReadableFile(String path) {
  File f = new File(path);
  return f.isFile() && f.canRead() && f.length() >= 4;
}

Try / catch

try {
  Schema s = AvroNestedReader.loadSchemaFromContainer(bowl, path);
} catch (KettleException e) {
  Throwable root = e;
  while (root.getCause() != null) root = root.getCause();
  logError("Avro container read failed for " + path + ": " + root.getMessage(), root);
}

Prevention

When it happens

Trigger: loadSchemaFromContainer is called with a container filename whose file cannot be resolved or opened by KettleVFS (bad path, missing file, no permission), or the stream cannot be read as an Avro container (truncated file, empty file, not an Avro ObjectContainer — DataFileStream constructor throws InvalidAvroMagicException/IOException, or reader.getSchema/close fails).

Common situations: Typing the wrong filename or extension for an 'Avro container file' schema source in the Avro Input dialog; pointing at a plain Avro JSON/record file instead of a container (no magic bytes Obj\u0001); file moved/deleted or on an inaccessible remote filesystem (S3/HDFS/FTP VFS misconfig); unreadable or partially uploaded/corrupted file.

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 pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/64ee69ac3a57018f. Report an issue: GitHub.

Appendix: source

Thrown at plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroNestedReader.java:1767

   * @param containerFilename the name of the Avro container file
   * @return the schema
   * @throws KettleException if a problem occurs
   */
  protected static Schema loadSchemaFromContainer( Bowl bowl, String containerFilename ) throws KettleException {
    Schema s = null;

    FileObject fileO = KettleVFS.getInstance( bowl ).getFileObject( containerFilename );
    InputStream in = null;

    try {
      in = KettleVFS.getInputStream( fileO );
      GenericDatumReader dr = new GenericDatumReader();
      DataFileStream reader = new DataFileStream( in, dr );
      s = reader.getSchema();

      reader.close();
    } catch ( FileSystemException e ) {
      throw new KettleException( BaseMessages
        .getString( PKG, "AvroInputDialog.Error.KettleFileException" ), e );
    } catch ( IOException e ) {
      throw new KettleException( BaseMessages
        .getString( PKG, "AvroInputDialog.Error.KettleFileException" ), e );
    }

    return s;
  }

}

View on GitHub (pinned to f3058517a1)