pentaho/pentaho-kettle · error · IOException
The width of a line can not be 0 or less.
Error message
The width of a line can not be 0 or less.
What it means
FixedInputDialog's OK/preview path writes the dialog's settings into a FixedFileInputMeta and validates that the configured line width parses as a positive integer. A width of 0 or less throws IOException 'The width of a line can not be 0 or less.' because fixed-width input cannot slice fields without a positive line width.
Solutions
- Enter a positive integer line width matching the fixed-width file layout (e.g. 80) in the dialog's Line width box.
- Remove any non-numeric characters or units from the width field.
- Use 'Get fields' after setting a valid width so field positions can be computed.
- If loading an existing step, reopen it and re-set the width lost during import/upgrade.
Example fix
// before oneMeta.setLineWidth( "0" ); // throws IOException // after oneMeta.setLineWidth( "80" ); // positive width
Defensive patterns
Strategy: validation
Validate before calling
int lineWidth = 0;
try { lineWidth = Integer.parseInt( oneMeta.getLineWidth() ); } catch ( NumberFormatException e ) { /* handle */ }
if ( lineWidth <= 0 ) {
// prompt user to enter a positive width before proceeding
} Try / catch
try {
getInfo( oneMeta );
} catch ( IOException e ) {
if ( e.getMessage().contains( "width of a line" ) ) {
// focus the line-width field and ask the user for a positive integer
}
} Prevention
- Always set a positive numeric line width before previewing or confirming the dialog.
- Never include units or symbols in the width field.
- Re-check width settings after importing or upgrading fixed-input steps.
When it happens
Trigger: Clicking OK or preview on the Fixed file input dialog when the 'line width' field is empty, 0, negative, or non-numeric (parseInt throws NumberFormatException at Integer.parseInt(oneMeta.getLineWidth())).
Common situations: User left the line-width field at its default 0 before configuring fields; copy-pasted a value with units ('80px'); a saved configuration lost its width value after an upgrade or import.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- A connection of type PALO is expected
- A server socket allocation always has to accompanied by…
- DimensionLookupMeta.Error.NoTechnicalKeySpecified
- DimensionLookupMeta.Exception.UnableToFindReturnField
- DynamicSQLRow.Exception.SQLFieldNameEmpty
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/b1fa09ea48031330.
Report an issue: GitHub.
Appendix: source
Thrown at ui/src/main/java/org/pentaho/di/ui/trans/steps/fixedinput/FixedInputDialog.java:833
shell, BaseMessages.getString( PKG, "FixedInputDialog.ErrorShowingFixedWizard.DialogTitle" ),
BaseMessages.getString( PKG, "FixedInputDialog.ErrorShowingFixedWizard.DialogMessage" ), e );
}
}
// Grab the first x lines from the given file...
//
private List<String> getFirst( FixedInputMeta meta, int limit ) throws IOException, KettleValueException {
List<String> lines = new ArrayList<String>();
FixedInputMeta oneMeta = new FixedInputMeta();
getInfo( oneMeta );
// Add a single field with the width of the line...
//
int lineWidth = Integer.parseInt( oneMeta.getLineWidth() );
if ( lineWidth <= 0 ) {
throw new IOException( "The width of a line can not be 0 or less." );
}
oneMeta.allocate( 1 );
FixedFileInputField field = new FixedFileInputField();
field.setName( "Field1" );
field.setType( ValueMetaInterface.TYPE_STRING );
field.setWidth( lineWidth );
//CHECKSTYLE:Indentation:OFF
oneMeta.getFieldDefinition()[0] = field;
TransMeta previewMeta =
TransPreviewFactory.generatePreviewTransformation( transMeta, oneMeta, wStepname.getText() );
TransPreviewProgressDialog progressDialog =
new TransPreviewProgressDialog(
shell, previewMeta, new String[] { wStepname.getText() }, new int[] { limit } );
progressDialog.open();View on GitHub (pinned to f3058517a1)