{"record":{"id":"16677b27a88dab0d","repo":"apache/flink","slug":"the-timeout-for-opening-the-input-splits-must-be-p","errorCode":null,"errorMessage":"The timeout for opening the input splits must be positive or zero (= infinite).","messagePattern":"The timeout for opening the input splits must be positive or zero \\(= infinite\\)\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java","lineNumber":347,"sourceCode":"        return numSplits;\n    }\n\n    public void setNumSplits(int numSplits) {\n        if (numSplits < -1 || numSplits == 0) {\n            throw new IllegalArgumentException(\n                    \"The desired number of splits must be positive or -1 (= don't care).\");\n        }\n\n        this.numSplits = numSplits;\n    }\n\n    public long getOpenTimeout() {\n        return openTimeout;\n    }\n\n    public void setOpenTimeout(long openTimeout) {\n        if (openTimeout < 0) {\n            throw new IllegalArgumentException(\n                    \"The timeout for opening the input splits must be positive or zero (= infinite).\");\n        }\n        this.openTimeout = openTimeout;\n    }\n\n    public void setNestedFileEnumeration(boolean enable) {\n        this.enumerateNestedFiles = enable;\n    }\n\n    public boolean getNestedFileEnumeration() {\n        return this.enumerateNestedFiles;\n    }\n\n    // --------------------------------------------------------------------------------------------\n    // Getting information about the split that is currently open\n    // --------------------------------------------------------------------------------------------\n\n    /**","sourceCodeStart":329,"sourceCodeEnd":365,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java#L329-L365","documentation":"openTimeout caps how long the format waits for a filesystem stream to open before failing (e.g. slow remote filesystems). Zero means infinite wait (no timeout), which is allowed. Negative values are meaningless, so FileInputFormat.setOpenTimeout rejects them with IllegalArgumentException.","triggerScenarios":"Calling format.setOpenTimeout(-1) or any negative long.","commonSituations":"Passing -1 intending 'infinite' (the infinite sentinel is 0, not -1); computing the timeout from a config that uses -1 as 'undefined'; subtracting deltas that underflow.","solutions":["Pass 0 for infinite wait, or a positive millisecond value (e.g. format.setOpenTimeout(60_000)).","Coerce: openTimeout = configured >= 0 ? configured : 0.","Leave the default (DEFAULT_OPENING_TIMEOUT from FS_STREAM_OPENING_TIME_OUT) if unsure."],"exampleFix":"// before\nformat.setOpenTimeout(timeoutMs); // timeoutMs == -1 -> throws\n\n// after\nlong t = timeoutMs >= 0 ? timeoutMs : 0;\nformat.setOpenTimeout(t);","handlingStrategy":"validation","validationCode":"long t = openTimeout >= 0 ? openTimeout : 0;\nformat.setOpenTimeout(t);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember 0 (not -1) means infinite wait.","Coerce negative timeouts to 0 or a positive default.","Use FS_STREAM_OPENING_TIME_OUT default when unsure."],"tags":["input-format","timeout","validation","illegal-argument"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}