pentaho/pentaho-kettle · error · KettleException

Fields must be defined to do a preview

Error message

Fields must be defined to do a preview

What it means

In PaloCellInputDialog.preview(), after copying dialog settings into a fresh PaloCellInputMeta via getInfo(), the code validates that at least one field is defined; an empty fields list throws 'Fields must be defined to do a preview'. This is a pure pre-flight validation before running the preview transformation.

Solutions

  1. Add at least one dimension field row in the fields table before clicking Preview
  2. Give each field an output type (otherwise the sibling 'All fields must have an output type' error fires)
  3. Save and reopen the dialog if the grid contents seem lost, then re-enter fields

Example fix

// before
fields table: [] // clicked Preview
// after
fields table: [{ fieldName: 'Year', fieldType: 'String' }]
Defensive patterns

Strategy: validation

Validate before calling

if (meta.getFields() == null || meta.getFields().size() == 0) {
  throw new KettleException("Define at least one field before preview");
}
for (DimensionField f : meta.getFields()) {
  if (Utils.isEmpty(f.getFieldType())) throw new KettleException("Field " + f.getFieldName() + " needs an output type");
}

Type guard

boolean canPreview(PaloCellInputMeta m) { return m.getFields() != null && !m.getFields().isEmpty(); }

Try / catch

try { preview(); } catch (KettleException e) { MessageBox box = new MessageBox(shell, SWT.ICON_ERROR); box.setMessage(e.getMessage()); box.open(); }

Prevention

When it happens

Trigger: Clicking Preview in the Palo Cell Input dialog while the fields table has no rows (getFields() null or size 0).

Common situations: User clicked Preview before filling in the dimension fields grid; fields were deleted but Preview clicked anyway; getInfo() failed to map the grid contents into the meta.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at plugins/palo/core/src/main/java/org/pentaho/di/ui/trans/steps/palo/cellinput/PaloCellInputDialog.java:509

    for ( int i = 0; i < tableViewFields.table.getItemCount(); i++ ) {
      DimensionField field =
        new DimensionField( tableViewFields.table.getItem( i ).getText( 1 ), tableViewFields.table.getItem( i )
          .getText( 2 ), tableViewFields.table.getItem( i ).getText( 3 ) );
      fields.add( field );
    }
    myMeta.setDatabaseMeta( transMeta.findDatabase( addConnectionLine.getText() ) );
    myMeta.setCubeMeasureName( new DimensionField( "Measure", textMeasureName.getText(), comboMeasureType.getText() ) );
    myMeta.setLevels( fields );
    myMeta.setCube( comboCube.getText() );
    myMeta.setChanged( true );
  }

  private void preview() {
    PaloCellInputMeta oneMeta = new PaloCellInputMeta();
    try {
      getInfo( oneMeta );
      if ( oneMeta.getFields() == null || oneMeta.getFields().size() == 0 ) {
        throw new KettleException( "Fields must be defined to do a preview" );
      } else {
        for ( DimensionField field : oneMeta.getFields() ) {
          if ( Utils.isEmpty( field.getFieldType() ) ) {
            throw new KettleException( "All fields must have an output type to do the preview" );
          }
        }
      }
    } catch ( KettleException e ) {
      new ErrorDialog( shell, BaseMessages.getString( PKG, "RowGeneratorDialog.Illegal.Dialog.Settings.Title" ),
        BaseMessages.getString( PKG, "RowGeneratorDialog.Illegal.Dialog.Settings.Message" ), e );
      return;
    }

    TransMeta previewMeta =
      TransPreviewFactory.generatePreviewTransformation( transMeta, oneMeta, textStepName.getText() );

    EnterNumberDialog numberDialog =
      new EnterNumberDialog( shell, 500, BaseMessages.getString( PKG, "System.Dialog.EnterPreviewSize.Title" ),

View on GitHub (pinned to f3058517a1)