{"record":{"id":"ea2bc1e2ba9cac20","repo":"apache/flink","slug":"could-not-create-recordreader","errorCode":null,"errorMessage":"Could not create RecordReader.","messagePattern":"Could not create RecordReader\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapreduce/HadoopInputFormatBase.java","lineNumber":195,"sourceCode":"    public InputSplitAssigner getInputSplitAssigner(HadoopInputSplit[] inputSplits) {\n        return new LocatableInputSplitAssigner(inputSplits);\n    }\n\n    @Override\n    public void open(HadoopInputSplit split) throws IOException {\n\n        // enforce sequential open() calls\n        synchronized (OPEN_MUTEX) {\n            TaskAttemptContext context =\n                    new TaskAttemptContextImpl(configuration, new TaskAttemptID());\n\n            try {\n                this.recordReader =\n                        this.mapreduceInputFormat.createRecordReader(\n                                split.getHadoopInputSplit(), context);\n                this.recordReader.initialize(split.getHadoopInputSplit(), context);\n            } catch (InterruptedException e) {\n                throw new IOException(\"Could not create RecordReader.\", e);\n            } finally {\n                this.fetched = false;\n            }\n        }\n    }\n\n    @Override\n    public boolean reachedEnd() throws IOException {\n        if (!this.fetched) {\n            fetchNext();\n        }\n        return !this.hasNext;\n    }\n\n    protected void fetchNext() throws IOException {\n        try {\n            this.hasNext = this.recordReader.nextKeyValue();\n        } catch (InterruptedException e) {","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapreduce/HadoopInputFormatBase.java#L177-L213","documentation":"Wraps an InterruptedException raised while open() creates and initializes the Hadoop RecordReader for a given split (createRecordReader + recordReader.initialize). Flink converts it to an IOException to honour the InputFormat contract. The split has already been assigned to the task when this fires, so it reflects a failure to start reading, usually thread interruption.","triggerScenarios":"Produced in HadoopInputFormatBase.open(split) when mapreduceInputFormat.createRecordReader(...) or recordReader.initialize(...) throws InterruptedException — typically because the task was cancelled/failing during reader setup, or the reader's initialization performs blocking I/O that was interrupted.","commonSituations":"Task cancelled while opening a split; reader initialization against a remote filesystem interrupted; restart of a failed task where the previous attempt's interruption is still in flight; custom RecordReader whose initialize blocks and mishandles interrupts.","solutions":["Look at the wrapped InterruptedException in the logs to identify cancellation or upstream task failure that interrupted reader initialization.","Verify the input data path is reachable from the TaskManager (HDFS/S3 connectivity, permissions).","If using a custom RecordReader, ensure initialize() does not swallow InterruptedException into infinite blocking.","Retry/restart the job if the interruption was transient (network blip during open)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    hadoopInputFormat.open(split);\n} catch (IOException e) {\n    if (e.getCause() instanceof InterruptedException) {\n        LOG.warn(\"RecordReader open interrupted; check task cancellation\", e);\n        // do not retry blindly — let Flink failover handle it\n    } else {\n        throw e;\n    }\n}","preventionTips":["Verify the split's data path is reachable from the TaskManager before open().","Ensure custom RecordReaders initialize() without blocking indefinitely.","Correlate interruptions with task cancel/failover.","Keep reader initialization fast and interruptible."],"tags":["hadoop","mapreduce","record-reader","interrupted","task-open"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}