pentaho/pentaho-kettle · error · KettleStepException

AddSequence.Exception.NoSpecifiedMethod

Error message

AddSequence.Exception.NoSpecifiedMethod

What it means

The AddSequence step in Pentaho Kettle throws this KettleStepException when the step is not configured to generate sequence values by any of its supported methods (database sequence, counter, or 'get value from field'). The code reaches the final 'else' branch of addSequence() only when data.realDatabaseMeta/data.realSequenceName and counter-based configuration are all absent, which the comment notes 'should never happen'. It indicates the step metadata was loaded into a state with no sequence generation method defined.

Solutions

  1. Open the AddSequence step dialog and explicitly select a sequence method: either a database connection + sequence name, or a counter with start/increment/max values
  2. Inspect the transformation XML (or repository record) and ensure the use_database, sequence fields, or counter attributes are present and populated
  3. Call setDefault() on a freshly built AddSequenceMeta and then set valuename plus the desired method fields before running the transformation
  4. Wrap step execution in a validation that checks meta has a method before starting the transformation

Example fix

// before (programmatic meta, no method set)
AddSequenceMeta meta = new AddSequenceMeta();
meta.setValuename("seq");
// after (counter method configured)
AddSequenceMeta meta = new AddSequenceMeta();
meta.setValuename("seq");
meta.setCounterName("cnt");
meta.setStartAt(1L);
meta.setIncrementBy(1L);
Defensive patterns

Strategy: validation

Validate before calling

AddSequenceMeta meta = (AddSequenceMeta) stepMeta.getStepMetaInterface();
boolean hasMethod = meta.isDatabase() || (meta.getCounterName() != null && meta.getStartAt() != null);
if (!hasMethod) throw new IllegalStateException("AddSequence step '" + stepMeta.getName() + "' has no sequence method configured");

Type guard

boolean hasSequenceMethod(AddSequenceMeta m) {
  return m != null && (m.isDatabase() || m.getCounterName() != null);
}

Try / catch

try {
  row = addSequence(inputRow);
} catch (KettleStepException e) {
  if (e.getMessage().contains("NoSpecifiedMethod")) {
    logError("AddSequence step has no sequence method configured; fix step settings");
    stopTransformation();
  } else throw e;
}

Prevention

When it happens

Trigger: Calling addSequence() on an AddSequence step whose meta has neither a database+sequence name pair nor counter parameters (useDatabase flag false or unset, no counter start/increment configured). Typically a transformation XML/repository record where the sequence method settings are missing or all blank, so meta validation passed but no method is selected.

Common situations: Hand-edited or truncated transformation XML losing the <use_database>/<counter> tags; a step copied between transformations with database metadata unresolved; programmatic construction of AddSequenceMeta via setDefault() without setting any method; version migration dropping legacy sequence attributes.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

Thrown at plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/addsequence/AddSequence.java:79

          nval = data.start;
        }
        if ( data.increment < 0 && data.maximum < data.start && nval < data.maximum ) {
          nval = data.start;
        }
        data.counter.setCounter( nval );

        next = prev;
      }
    } else if ( meta.isDatabaseUsed() ) {
      try {
        next = data.getDb().getNextSequenceValue( data.realSchemaName, data.realSequenceName, meta.getValuename() );
      } catch ( KettleDatabaseException dbe ) {
        throw new KettleStepException( BaseMessages.getString(
          PKG, "AddSequence.Exception.ErrorReadingSequence", data.realSequenceName ), dbe );
      }
    } else {
      // This should never happen, but if it does, don't continue!!!
      throw new KettleStepException( BaseMessages.getString( PKG, "AddSequence.Exception.NoSpecifiedMethod" ) );
    }

    if ( next != null ) {
      Object[] outputRowData = inputRowData;
      if ( inputRowData.length < inputRowMeta.size() + 1 ) {
        outputRowData = RowDataUtil.resizeArray( inputRowData, inputRowMeta.size() + 1 );
      }
      outputRowData[inputRowMeta.size()] = next;
      return outputRowData;
    } else {
      throw new KettleStepException( BaseMessages.getString(
        PKG, "AddSequence.Exception.CouldNotFindNextValueForSequence" )
        + meta.getValuename() );
    }
  }

  public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException {
    meta = (AddSequenceMeta) smi;

View on GitHub (pinned to f3058517a1)