pentaho/pentaho-kettle · error · KettleException

Error serializing rows of data to the MonetDB API (MAPI).

Error message

Error serializing rows of data to the MonetDB API (MAPI).

What it means

addRowToBuffer serializes one incoming row into the MAPI bulk-load line format (escaping delimiters, building a line string) and stores it in data.rowBuffer. Any exception during serialization is wrapped in KettleException with this message. It indicates a row's data could not be converted into the text format MonetDB's bulk load expects.

Solutions

  1. Inspect the wrapped cause to find which field failed to convert
  2. Fix the field type mapping or add a Select Values step to convert types before the bulk loader
  3. Escape or clean problematic characters (newlines, delimiters) in string columns
  4. Check the target table's column formats and adjust date/number format settings on the step

Example fix

// before: string date into DATE column with wrong format
row[4] = "12/31/2024"
// after: convert upstream
// Select Values step: field 4, Date, format yyyy-MM-dd
Defensive patterns

Strategy: validation

Validate before calling

// Sanitize/convert fields before the bulk loader
for (int i = 0; i < rowMeta.size(); i++) {
  ValueMetaInterface vm = rowMeta.getValueMeta(i);
  Object v = row[i];
  if (vm.isString() && v != null && v.toString().contains("\n")) {
    throw new IllegalArgumentException("Field " + vm.getName() + " contains newline; escape or strip it");
  }
}

Type guard

boolean isMapiSafe(ValueMetaInterface vm, Object v) {
  if (v == null) return true;
  if (vm.isString()) return !v.toString().contains("\n");
  return true;
}

Try / catch

try {
  writeRowToMonetDB(rowMeta, row);
} catch (KettleException e) {
  if (e.getMessage().contains("serializing rows")) {
    logError("Row conversion failed: " + e.getCause() + " — check field types/formats", e);
  }
}

Prevention

When it happens

Trigger: writeRowToMonetDB calls addRowToBuffer and the row conversion throws — typically a ValueMeta conversion failure (malformed date/number), null handling issues, or string content breaking the line format.

Common situations: Source fields not matching the target column types (text in a numeric column); date formats not matching the expected load format; special characters/newlines in string data.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/9a61b3acd53dcc5f. Report an issue: GitHub.

Appendix: source

Thrown at plugins/monet-db-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/monetdbbulkloader/MonetDBBulkLoader.java:377

              break;
            default:
              break;
          }
        } else {
          line.append( data.nullrepresentation );
        }
      }

      // finally write a newline
      //
      line.append( data.newline );

      // Now that we have the line, grab the content and store it in the buffer...
      //
      data.rowBuffer[data.bufferIndex] = line.toString(); // line.toByteArray();
      data.bufferIndex++;
    } catch ( Exception e ) {
      throw new KettleException( "Error serializing rows of data to the MonetDB API (MAPI).", e );
    }

  }

  public void truncate() throws KettleException {
    String cmd;
    String table = data.schemaTable;
    String truncateStatement = meta.getDatabaseMeta().getTruncateTableStatement( null, table );
    if ( truncateStatement == null ) {
      throw new KettleException( "Truncate table is not supported!" );
    }
    cmd = truncateStatement + ";";

    try {
      executeSql( cmd );
    } catch ( Exception e ) {
      throw new KettleException( "Error while truncating table " + table, e );
    }

View on GitHub (pinned to f3058517a1)