apache/flink · error · IOException

Error reconstructing URI

Error message

Error reconstructing URI

What it means

Thrown during Path deserialization from a DataInputView when the 7-component URI (scheme, userInfo, host, port, path, query, fragment) read back from the stream does not form a syntactically valid URI. It wraps the underlying URISyntaxException in an IOException so the failure is visible to serialization callers.

Source

Thrown at flink-core/src/main/java/org/apache/flink/core/fs/Path.java:523

     * @throws IOException if an error happened.
     */
    @Nullable
    public static Path deserializeFromDataInputView(DataInputView in) throws IOException {
        final boolean isNotNull = in.readBoolean();
        Path result = null;
        if (isNotNull) {
            final String scheme = StringUtils.readNullableString(in);
            final String userInfo = StringUtils.readNullableString(in);
            final String host = StringUtils.readNullableString(in);
            final int port = in.readInt();
            final String path = StringUtils.readNullableString(in);
            final String query = StringUtils.readNullableString(in);
            final String fragment = StringUtils.readNullableString(in);

            try {
                result = new Path(new URI(scheme, userInfo, host, port, path, query, fragment));
            } catch (URISyntaxException e) {
                throw new IOException("Error reconstructing URI", e);
            }
        }
        return result;
    }

    /**
     * Serialize the path to {@link DataInputView}.
     *
     * @param path the file path.
     * @param out the data out put view.
     * @throws IOException if an error happened.
     */
    public static void serializeToDataOutputView(Path path, DataOutputView out) throws IOException {
        URI uri = path.toUri();
        if (uri == null) {
            out.writeBoolean(false);
        } else {
            out.writeBoolean(true);

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Verify the source of the DataInputView is intact and complete (not truncated mid-record).
  2. Confirm the writer and reader use the same Flink version, or run a state/savepoint migration path.
  3. Inspect the wrapped URISyntaxException in the cause chain for the exact malformed component.
  4. If state is unrecoverable, restart from a known-good checkpoint or savepoint.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    Path p = Path.deserializeFromDataInputView(in);
} catch (IOException e) {
    // inspect e.getCause() which is the URISyntaxException
    if (e.getCause() instanceof URISyntaxException) { /* handle corruption */ }
    throw e;
}

Prevention

When it happens

Trigger: Reading a serialized Path whose stored components were corrupted, truncated, or written by a mismatched serialization version. `Path.deserializeFromDataInputView(in)` reconstructs via `new URI(...)` which validates syntax.

Common situations: State/checkpoint corruption; a Flink version upgrade changed serialization format; reading a stream that was partially written or truncated across a checkpoint boundary; reading data serialized by a different (older/newer) Flink release.

Related errors


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/b167042c7e92dc44. Report an issue: GitHub.