pentaho/pentaho-kettle · error · DuplicateParamException

Duplicate parameter ' ' detected.

Error message

Duplicate parameter '${key}' detected.

What it means

NamedParamsDefault.addParameterDefinition registers a named parameter with a default value and description, storing it in an internal map. If a parameter with the same key already exists, it refuses to overwrite and throws DuplicateParamException. This protects existing parameter values from being silently reset by re-registration.

Solutions

  1. Check parameter existence first with existsParameter(key) (or listParameters()) and skip duplicates.
  2. Call eraseParameters() before re-adding the full parameter set.
  3. When copying, clear the destination first or filter out keys the target already defines.
  4. If overwrite is intended, remove the old parameter then add the new definition.

Example fix

// before
params.addParameterDefinition("MY_PARAM", "def", "desc"); // throws if exists
// after
if (!params.existsParameter("MY_PARAM")) {
  params.addParameterDefinition("MY_PARAM", "def", "desc");
}
Defensive patterns

Strategy: validation

Validate before calling

if (!namedParams.existsParameter(key)) {
  namedParams.addParameterDefinition(key, defaultValue, description);
}

Type guard

static boolean safeAddParameter(NamedParams params, String key, String def, String desc) {
  try { params.addParameterDefinition(key, def, desc); return true; }
  catch (DuplicateParamException e) { return false; }
}

Try / catch

try {
  params.addParameterDefinition(key, defaultValue, description);
} catch (DuplicateParamException e) {
  log.logBasic("Parameter already defined, keeping existing value: " + key);
}

Prevention

When it happens

Trigger: Calling addParameterDefinition(key, defaultValue, description) twice with the same key, or via copyParametersFrom / mergeParametersWith when the source and target already share a parameter name.

Common situations: Merging two transformations/jobs that both define the same parameter; re-running setup code that adds parameters without first clearing them; copyParametersFrom into an object whose parameters were already populated.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


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

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/parameters/NamedParamsDefault.java:77

   * Default constructor.
   */
  public NamedParamsDefault() {
  }

  @Override
  public void addParameterDefinition( String key, String defValue, String description ) throws DuplicateParamException {

    if ( params.get( key ) == null ) {
      OneNamedParam oneParam = new OneNamedParam();

      oneParam.key = key;
      oneParam.defaultValue = defValue;
      oneParam.description = description;
      oneParam.value = "";

      params.put( key, oneParam );
    } else {
      throw new DuplicateParamException( "Duplicate parameter '" + key + "' detected." );
    }
  }

  @Override
  public String getParameterDescription( String key ) throws UnknownParamException {
    String description = null;

    OneNamedParam theParam = params.get( key );
    if ( theParam != null ) {
      description = theParam.description;
    }

    return description;
  }

  @Override
  public String getParameterValue( String key ) throws UnknownParamException {
    String value = null;

View on GitHub (pinned to f3058517a1)