deeplearning4j/deeplearning4j · error · RuntimeException
Error reading URI file
Error message
Error reading URI file
What it means
JacksonRecordReader.next() wraps any IOException raised while opening or reading the InputStream for the current URI into a RuntimeException with message 'Error reading URI file'. It means the underlying JSON file could not be read (missing file, permission problem, or stream failure), not that the JSON content was invalid. The original IOException is chained as the cause.
Solutions
- Verify every URI in the InputSplit exists and is readable before initialize()
- Catch IOException/RuntimeException in the caller and inspect the chained cause
- Regenerate the InputSplit if files moved or were deleted
- Check filesystem/DFS permissions for the process user
Example fix
// before
reader.initialize(conf, split); // stale split, files moved
List<Writable> r = reader.next();
// after
File f = new File(uri.getPath());
if (!f.isFile() || !f.canRead()) throw new IllegalStateException("Missing input file: " + uri);
reader.initialize(conf, split);
List<Writable> r = reader.next(); Defensive patterns
Strategy: try-catch
Validate before calling
for (URI u : uris) { File f = new File(u.getPath()); if (!f.isFile() || !f.canRead()) throw new IllegalStateException("Unreadable: " + u); } Try / catch
try { List<Writable> r = reader.next(); } catch (RuntimeException e) { IOException cause = (IOException) e.getCause(); log.error("URI read failed: "+cause.getMessage(), cause); } Prevention
- Validate split URIs before initialize
- Keep source files in place for the whole job
- Run the reader as a user with read access to the data directory
When it happens
Trigger: streamCreatorFn.apply(uri) fails to open the URI, or IOUtils.toString throws IOException mid-read during next().
Common situations: InputSplit URIs pointing to files deleted or moved after split creation; unreadable file permissions; network/DFS URI that dropped; wrong charset on a corrupted stream.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- Error loading checkpoint data from file…
- Error reading from input stream: + uri
- Error reading from stream
- Error reading from stream for URI: + next
- Failed to read complete header from
AI-assisted analysis of deeplearning4j/deeplearning4j@4c22ac5fe4 (2026-09-07).
Data as JSON: /api/errors/a8e359421ddf7594.
Report an issue: GitHub.
Appendix: source
Thrown at datavec/datavec-api/src/main/java/org/datavec/api/records/reader/impl/jackson/JacksonRecordReader.java:118
@Override
public void initialize(Configuration conf, InputSplit split) throws IOException, InterruptedException {
initialize(split);
}
@Override
public List<Writable> next() {
if (uris == null)
throw new IllegalStateException("URIs are null. Not initialized?");
if (!hasNext())
throw new NoSuchElementException("No next element");
URI uri = uris[cursor++];
invokeListeners(uri);
String fileAsString;
try (InputStream s = streamCreatorFn.apply(uri)){
fileAsString = IOUtils.toString(s, charset);
} catch (IOException e) {
throw new RuntimeException("Error reading URI file", e);
}
return readValues(uri, fileAsString);
}
@Override
public boolean hasNext() {
return cursor < uris.length;
}
@Override
public List<String> getLabels() {
throw new UnsupportedOperationException();
}
@Override
public void reset() {View on GitHub (pinned to 4c22ac5fe4)