pentaho/pentaho-kettle · error · KettleException
Unable to get next value for slave sequence '" + name + "'…
Error message
Unable to get next value for slave sequence '" + name + "' on database '" + databaseMeta.getName() + "'
What it means
SlaveSequence.getNextValue fetches the next value of a Carte 'slave sequence' (a sequence used to coordinate clustered transformation runs) from the underlying database, wrapping any failure (SQL error, sequence missing, connection failure) in a KettleException that names the sequence and database. The database handle is always closed in the finally block. It means the DB-side increment for the slave sequence could not be performed.
Solutions
- Inspect the chained cause e for the actual SQL error from databaseMeta.getName() target.
- Verify the database connection defined for the slave sequence (host, port, credentials) works from the Carte node.
- Check the sequence/table backing the slave sequence still exists and the DB user has privileges on it.
- Recreate the slave sequence (or let SlaveServerConfig.readAutoSequences recreate it) if it was dropped.
- Confirm the database dialect matches the actual DBMS so the generated sequence SQL is valid.
Example fix
// before: sequence points at a dead host
SequenceMeta seq = new SequenceMeta("cluster_seq", dbMetaOn("10.0.0.9", "seqdb"), ...);
// after: point at a reachable, verified database
DatabaseMeta db = dbMetaOn("10.0.0.5", "seqdb"); // verified with a test connection
SequenceMeta seq = new SequenceMeta("cluster_seq", db, ...); Defensive patterns
Strategy: try-catch
Validate before calling
// verify the sequence DB is reachable before starting clustered runs
DatabaseMeta db = ...;
try (Connection c = DriverManager.getConnection(db.getURL(), db.getUsername(), db.getPassword())) {
if (!c.isValid(5)) throw new SQLException("sequence DB not reachable");
} Try / catch
try {
long v = slaveSequence.nextValue(name);
} catch (KettleException e) {
log.error("Slave sequence '{}' failed on db '{}': {}", name, dbName, e.getCause(), e);
// alert / fail the cluster startup; do not retry blindly if the cause is SQL/privilege related
} Prevention
- Health-check the sequence database in Carte startup scripts.
- Grant the DB account the privileges needed to select/increment sequences.
- Back up and restore sequence rows when migrating the sequence DB.
When it happens
Trigger: nextValue(name) called during clustered/partitioned run setup while the backing database is unreachable, the SEQUENCE table/sequence object was dropped, or the generated SQL is invalid for that database dialect.
Common situations: Carte slave nodes configured with auto-sequence against a database that was migrated/renamed; DB user lacks SELECT/ALTER on the sequence; sequence schema created on one DB type (e.g. Oracle) but Carte points at another (e.g. PostgreSQL) where the SQL is invalid.
Understand the failure class
Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.
Related errors
- Unable to automatically configure slave sequences
- AddSequence.Exception.ErrorReadingSequence
- A server socket allocation always has to accompanied by a…
- A server socket allocation always has to accompanied by a…
- A server socket allocation always has to accompanied by a…
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/e542ca0e9b361dc0.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/www/SlaveSequence.java:144
//
if ( update ) {
sql = "UPDATE " + schemaTable + " SET " + valField + "= ? WHERE " + seqField + "= ? ";
param = new RowMetaAndData();
param.addValue( valField, ValueMetaInterface.TYPE_INTEGER, Long.valueOf( maximum ) );
param.addValue( seqField, ValueMetaInterface.TYPE_STRING, name );
} else {
sql = "INSERT INTO " + schemaTable + "(" + seqField + ", " + valField + ") VALUES( ? , ? )";
param = new RowMetaAndData();
param.addValue( seqField, ValueMetaInterface.TYPE_STRING, name );
param.addValue( valField, ValueMetaInterface.TYPE_INTEGER, Long.valueOf( maximum ) );
}
db.execStatement( sql, param.getRowMeta(), param.getData() );
return value;
} catch ( Exception e ) {
throw new KettleException( "Unable to get next value for slave sequence '"
+ name + "' on database '" + databaseMeta.getName() + "'", e );
} finally {
db.close();
}
}
public SlaveSequence( Node node, List<DatabaseMeta> databases ) throws KettleXMLException {
name = XMLHandler.getTagValue( node, "name" );
startValue = Const.toInt( XMLHandler.getTagValue( node, "start" ), 0 );
databaseMeta = DatabaseMeta.findDatabase( databases, XMLHandler.getTagValue( node, "connection" ) );
schemaName = XMLHandler.getTagValue( node, "schema" );
tableName = XMLHandler.getTagValue( node, "table" );
sequenceNameField = XMLHandler.getTagValue( node, "sequence_field" );
valueField = XMLHandler.getTagValue( node, "value_field" );
}
public String getXML() {
StringBuilder xml = new StringBuilder( 100 );View on GitHub (pinned to f3058517a1)