{"record":{"id":"72ebdf475b1df0ad","repo":"apache/flink","slug":"line-length-limit-must-be-at-least-1","errorCode":null,"errorMessage":"Line length limit must be at least 1.","messagePattern":"Line length limit must be at least 1\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/common/io/DelimitedInputFormat.java","lineNumber":255,"sourceCode":"    public void setDelimiter(char delimiter) {\n        setDelimiter(String.valueOf(delimiter));\n    }\n\n    public void setDelimiter(String delimiter) {\n        if (delimiter == null) {\n            throw new IllegalArgumentException(\"Delimiter must not be null\");\n        }\n        this.delimiter = delimiter.getBytes(getCharset());\n        this.delimiterString = delimiter;\n    }\n\n    public int getLineLengthLimit() {\n        return lineLengthLimit;\n    }\n\n    public void setLineLengthLimit(int lineLengthLimit) {\n        if (lineLengthLimit < 1) {\n            throw new IllegalArgumentException(\"Line length limit must be at least 1.\");\n        }\n\n        this.lineLengthLimit = lineLengthLimit;\n    }\n\n    public int getBufferSize() {\n        return bufferSize;\n    }\n\n    public void setBufferSize(int bufferSize) {\n        if (bufferSize < 2) {\n            throw new IllegalArgumentException(\"Buffer size must be at least 2.\");\n        }\n\n        this.bufferSize = bufferSize;\n    }\n\n    public int getNumLineSamples() {","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/common/io/DelimitedInputFormat.java#L237-L273","documentation":"DelimitedInputFormat uses lineLengthLimit as a safety bound to detect unparseable/malformed records (records spanning more bytes than the limit abort reading with an IOException). A limit < 1 is meaningless and would reject every record, so setLineLengthLimit enforces a minimum of 1.","triggerScenarios":"Calling format.setLineLengthLimit(0) or any negative value.","commonSituations":"Misconfiguring the max record length from a property that defaulted to 0; passing -1 to mean 'unlimited' (this format has no unlimited sentinel — use a large value instead).","solutions":["Set a positive limit, e.g. format.setLineLengthLimit(1024 * 1024) for 1 MB records.","If you intend 'effectively unlimited', set a very large value such as Integer.MAX_VALUE.","Validate the configured limit is >= 1 before calling setLineLengthLimit."],"exampleFix":"// before\nformat.setLineLengthLimit(maxRecordBytes); // maxRecordBytes == 0 -> throws\n\n// after\nint limit = maxRecordBytes > 0 ? maxRecordBytes : Integer.MAX_VALUE;\nformat.setLineLengthLimit(limit);","handlingStrategy":"validation","validationCode":"int limit = configuredLineLengthLimit > 0 ? configuredLineLengthLimit : Integer.MAX_VALUE;\nformat.setLineLengthLimit(limit);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Map 0/negative to a large positive value (the format has no 'unlimited' sentinel).","Set the limit based on the largest legitimate record in your data.","Validate config-derived limits before calling setLineLengthLimit."],"tags":["input-format","delimited","line-length-limit","validation","illegal-argument"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}