{"record":{"id":"b1fa09ea48031330","repo":"pentaho/pentaho-kettle","slug":"the-width-of-a-line-can-not-be-0-or-less","errorCode":null,"errorMessage":"The width of a line can not be 0 or less.","messagePattern":"The width of a line can not be 0 or less\\.","errorType":"validation","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"ui/src/main/java/org/pentaho/di/ui/trans/steps/fixedinput/FixedInputDialog.java","lineNumber":833,"sourceCode":"        shell, BaseMessages.getString( PKG, \"FixedInputDialog.ErrorShowingFixedWizard.DialogTitle\" ),\n        BaseMessages.getString( PKG, \"FixedInputDialog.ErrorShowingFixedWizard.DialogMessage\" ), e );\n    }\n  }\n\n  // Grab the first x lines from the given file...\n  //\n  private List<String> getFirst( FixedInputMeta meta, int limit ) throws IOException, KettleValueException {\n\n    List<String> lines = new ArrayList<String>();\n\n    FixedInputMeta oneMeta = new FixedInputMeta();\n    getInfo( oneMeta );\n\n    // Add a single field with the width of the line...\n    //\n    int lineWidth = Integer.parseInt( oneMeta.getLineWidth() );\n    if ( lineWidth <= 0 ) {\n      throw new IOException( \"The width of a line can not be 0 or less.\" );\n    }\n\n    oneMeta.allocate( 1 );\n\n    FixedFileInputField field = new FixedFileInputField();\n    field.setName( \"Field1\" );\n    field.setType( ValueMetaInterface.TYPE_STRING );\n    field.setWidth( lineWidth );\n    //CHECKSTYLE:Indentation:OFF\n    oneMeta.getFieldDefinition()[0] = field;\n\n    TransMeta previewMeta =\n      TransPreviewFactory.generatePreviewTransformation( transMeta, oneMeta, wStepname.getText() );\n\n    TransPreviewProgressDialog progressDialog =\n      new TransPreviewProgressDialog(\n        shell, previewMeta, new String[] { wStepname.getText() }, new int[] { limit } );\n    progressDialog.open();","sourceCodeStart":815,"sourceCodeEnd":851,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/ui/src/main/java/org/pentaho/di/ui/trans/steps/fixedinput/FixedInputDialog.java#L815-L851","documentation":"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.","triggerScenarios":"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())).","commonSituations":"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.","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."],"exampleFix":"// before\noneMeta.setLineWidth( \"0\" ); // throws IOException\n// after\noneMeta.setLineWidth( \"80\" ); // positive width","handlingStrategy":"validation","validationCode":"int lineWidth = 0;\ntry { lineWidth = Integer.parseInt( oneMeta.getLineWidth() ); } catch ( NumberFormatException e ) { /* handle */ }\nif ( lineWidth <= 0 ) {\n  // prompt user to enter a positive width before proceeding\n}","typeGuard":null,"tryCatchPattern":"try {\n  getInfo( oneMeta );\n} catch ( IOException e ) {\n  if ( e.getMessage().contains( \"width of a line\" ) ) {\n    // focus the line-width field and ask the user for a positive integer\n  }\n}","preventionTips":["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."],"tags":["fixed-input","validation","line-width","configuration"],"backgroundTag":"value-out-of-range","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}