{"record":{"id":"076dd287e5b74a18","repo":"deeplearning4j/deeplearning4j","slug":"null","errorCode":null,"errorMessage":"null","messagePattern":"null","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"datavec/datavec-api/src/main/java/org/datavec/api/records/reader/impl/regex/RegexSequenceRecordReader.java","lineNumber":157,"sourceCode":"\n        return out;\n    }\n\n    @Override\n    public void reset() {\n        super.reset();\n    }\n\n    @Override\n    public SequenceRecord nextSequence() {\n        Preconditions.checkState(hasNext(), \"No next element available\");\n        URI next = locationsIterator.next();\n\n        String fileContents;\n        try (InputStream s = streamCreatorFn.apply(next)){\n            fileContents = IOUtils.toString(s, charset);\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n        List<List<Writable>> sequence = loadSequence(fileContents, next);\n        return new org.datavec.api.records.impl.SequenceRecord(sequence, new RecordMetaDataURI(next, RegexSequenceRecordReader.class));\n    }\n\n    @Override\n    public SequenceRecord loadSequenceFromMetaData(RecordMetaData recordMetaData) throws IOException {\n        return loadSequenceFromMetaData(Collections.singletonList(recordMetaData)).get(0);\n    }\n\n    @Override\n    public List<SequenceRecord> loadSequenceFromMetaData(List<RecordMetaData> recordMetaDatas) throws IOException {\n        List<SequenceRecord> out = new ArrayList<>();\n        for (RecordMetaData meta : recordMetaDatas) {\n            File next = new File(meta.getURI());\n            URI uri = next.toURI();\n            String fileContents = FileUtils.readFileToString(next, charset.name());\n            List<List<Writable>> sequence = loadSequence(fileContents, uri);","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/deeplearning4j/deeplearning4j/blob/4c22ac5fe4a8350d05d224e7f4499429f7f69c93/datavec/datavec-api/src/main/java/org/datavec/api/records/reader/impl/regex/RegexSequenceRecordReader.java#L139-L175","documentation":"nextSequence() opens the next URI via the configured stream creator and reads the whole file with IOUtils.toString; any IOException is wrapped and rethrown as a RuntimeException with the underlying exception's (possibly null) message. A message of \"null\" means the wrapped I/O failure carried no detail, most commonly a NullPointerException on the stream or an I/O error without a message. It signals the sequence data source could not be read.","triggerScenarios":"Calling nextSequence() (directly or via sequenceRecord) when locationsIterator.next() returns a URI whose stream cannot be opened (missing file, bad path/URI scheme, streamCreatorFn returns null) or the stream fails mid-read with a message-less IOException.","commonSituations":"InputSplit pointing to files deleted or moved after split creation; unsupported URI scheme for the stream creator; HDFS/local path permissions; reading a directory instead of a file.","solutions":["Verify every URI in the InputSplit exists and is readable before iterating (Files.exists / FileSystem.checkPath)","Check that the stream creator lambda passed to the reader supports the URI scheme (file://, hdfs://, etc.)","Call nextSequence() inside try/catch for RuntimeException and inspect getCause() for the real IOException/NPE","Re-initialize the reader after files change so locationsIterator reflects the current filesystem"],"exampleFix":"// before\nSequenceRecord r = reader.nextSequence(); // throws RuntimeException(null)\n// after\nif (!new File(uri).exists()) { LOG.warn(\"Skipping missing file: \" + uri); continue; }\ntry { SequenceRecord r = reader.nextSequence(); } catch (RuntimeException e) { throw new RuntimeException(\"Failed reading \" + uri, e.getCause()); }","handlingStrategy":"try-catch","validationCode":"if (!Files.isReadable(Paths.get(uri))) { throw new IOException(\"Sequence file missing or unreadable: \" + uri); }","typeGuard":null,"tryCatchPattern":"try { seq = reader.nextSequence(); } catch (RuntimeException e) { Throwable c = e.getCause(); if (c instanceof IOException) { LOG.error(\"I/O failure reading sequence: \" + c.getMessage(), c); } else if (c == null || c instanceof NullPointerException) { LOG.error(\"Stream creator returned null stream for URI\"); } throw e; }","preventionTips":["Pre-check each URI in the InputSplit for existence and readability","Ensure the stream creator supports the URI scheme in use","Re-create the reader/split after files move or are deleted","Log the URI when catching to pinpoint the failing file"],"tags":["io","record-reader","file-read","null"],"backgroundTag":"file-read-failed","analyzedSha":"4c22ac5fe4a8350d05d224e7f4499429f7f69c93","analyzedAt":"2026-09-07T05:27:04.714Z","contentChangedAt":"2026-09-07T05:27:04.714Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}