pentaho/pentaho-kettle · error · KettleException
You can not get metrics for the current step [
Error message
You can not get metrics for the current step [
What it means
StepsMetrics collects runtime metrics from other steps in the same transformation. Referencing itself (the monitoring step's own name) in the monitored-steps list creates a cycle that cannot be resolved, so processRow throws this KettleException naming the offending step. The metrics of a step running this very code cannot be sampled by that step itself.
Solutions
- Remove the StepsMetrics step's own name from its monitored-steps grid.
- Rename the metrics step (e.g. 'Metrics sampler') so it cannot collide with monitored names.
- Re-check the list after renames — the check compares literal step names.
- If generating metadata in code, assert !monitored.equals(metricsStepName) before saving.
Example fix
// before: self-reference
meta.setStepName(new String[] { "Metrics", "Sort rows" }); // 'Metrics' is this step
// after: monitor only other steps
meta.setStepName(new String[] { "Sort rows", "Filter rows" }); Defensive patterns
Strategy: validation
Validate before calling
for (String monitored : meta.getStepName()) {
if (monitored.equals(metricsStepMeta.getName())) {
throw new IllegalArgumentException("StepsMetrics cannot monitor itself: " + monitored);
}
} Type guard
boolean noSelfReference(StepsMetricsMeta m, StepMeta self) {
String[] names = m.getStepName();
return names != null && java.util.Arrays.stream(names).noneMatch(n -> n.equals(self.getName()));
} Try / catch
try {
trans.execute(null);
} catch (KettleException e) {
if (e.getMessage().startsWith("You can not get metrics for the current step [")) {
throw new IllegalStateException("StepsMetrics self-reference in monitored list", e);
}
throw e;
} Prevention
- Give the metrics step a distinctive name (e.g. 'Metrics sampler') so it never collides with monitored steps.
- Re-verify monitored lists after renaming any step in the transformation.
- Assert no self-reference when generating StepsMetrics metadata in code.
When it happens
Trigger: The monitored 'step name' grid contains the same name as the StepsMetrics step itself (getStepname()), detected at processRow time when iterating stepnames.
Common situations: Renaming a monitored step to match the metrics step's name; misreading the dialog as 'steps to include' and adding the metrics step itself; generating the config programmatically with a self-reference.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- StepsMetrics.Error.NotSteps
- You can not get metrics for the target step [
- A connection of type PALO is expected
- A server socket allocation always has to accompanied by…
- AccessInput.Exception.CouldnotFindField
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/70c0d7916199c150.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/stepsmetrics/StepsMetrics.java:90
// check for output fields
data.realstepnamefield = environmentSubstitute( meta.getStepNameFieldName() );
data.realstepidfield = environmentSubstitute( meta.getStepIdFieldName() );
data.realsteplinesinputfield = environmentSubstitute( meta.getStepLinesInputFieldName() );
data.realsteplinesoutputfield = environmentSubstitute( meta.getStepLinesOutputFieldName() );
data.realsteplinesreadfield = environmentSubstitute( meta.getStepLinesReadFieldName() );
data.realsteplineswrittentfield = environmentSubstitute( meta.getStepLinesWrittenFieldName() );
data.realsteplinesupdatedfield = environmentSubstitute( meta.getStepLinesUpdatedFieldName() );
data.realsteplineserrorsfield = environmentSubstitute( meta.getStepLinesErrorsFieldName() );
data.realstepsecondsfield = environmentSubstitute( meta.getStepSecondsFieldName() );
// Get target stepnames
String[] targetSteps = getTransMeta().getNextStepNames( getStepMeta() );
data.stepInterfaces = new ConcurrentHashMap<Integer, StepInterface>();
for ( int i = 0; i < stepnrs; i++ ) {
// We can not get metrics from current step
if ( stepnames[i].equals( getStepname() ) ) {
throw new KettleException( "You can not get metrics for the current step [" + stepnames[i] + "]!" );
}
if ( targetSteps != null ) {
// We can not metrics from the target steps
for ( int j = 0; j < targetSteps.length; j++ ) {
if ( stepnames[i].equals( targetSteps[j] ) ) {
throw new KettleException( "You can not get metrics for the target step [" + targetSteps[j] + "]!" );
}
}
}
int CopyNr = Const.toInt( meta.getStepCopyNr()[i], 0 );
StepInterface si = getTrans().getStepInterface( stepnames[i], CopyNr );
if ( si != null ) {
data.stepInterfaces.put( i, getDispatcher().findBaseSteps( stepnames[i] ).get( CopyNr ) );
} else {
if ( meta.getStepRequired()[i].equals( StepsMetricsMeta.YES ) ) {
throw new KettleException( "We cannot get step [" + stepnames[i] + "] CopyNr=" + CopyNr + "!" );
}View on GitHub (pinned to f3058517a1)