apache/iceberg · warning

Uri convert to FileURI error! Uri is

Error message

Uri convert to FileURI error! Uri is {}.

What it means

FileUriKeySelector.getKey() attempts to convert a string URI into an Iceberg FileURI (normalizing path with configurable equal schemes/authorities) for keying streams. If the string is not a parseable URI, the conversion throws and the selector logs a warning and returns the INVALID_URI sentinel so the record is still keyed rather than failing the job.

Solutions

  1. Log/inspect the offending 'value' and fix the producer so it emits well-formed absolute file URIs.
  2. Check the equalSchemes/equalAuthorities configuration for typos that could break FileURI construction.
  3. Encode special characters in URIs at write time (spaces as %20, etc.).
  4. If INVALID_URI keys are acceptable and expected, raise log filtering or handle them explicitly downstream.

Example fix

// before: raw path with illegal characters
String path = "/warehouse/table/dir with space/file.parquet";
// after: encode before it reaches the selector
String path = "/warehouse/table/dir%20with%20space/file.parquet";
Defensive patterns

Strategy: validation

Validate before calling

boolean validUri = value != null && !value.isEmpty() && new Path(value).toUri() != null && new Path(value).toUri().getScheme() != null;

Type guard

boolean isParsableUri(String value) {
  try { new Path(value); return true; } catch (Exception e) { return false; }
}

Prevention

When it happens

Trigger: getKey(value) receives a string that new Path(value).toUri() or the FileURI constructor cannot parse — e.g. malformed URI, illegal characters, null/empty string, or a scheme the normalization logic rejects.

Common situations: Data files referenced in manifests contain unusual URIs (spaces, unencoded characters); a catalog returns relative or scheme-less paths; streaming maintenance records carry non-file strings (e.g. metrics or serialized results) passed through the same selector.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/20719007382a413a. Report an issue: GitHub.

Appendix: source

Thrown at flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/maintenance/operator/FileUriKeySelector.java:56

  static final String INVALID_URI = "__INVALID_URI__";

  private final Map<String, String> equalSchemes;
  private final Map<String, String> equalAuthorities;

  public FileUriKeySelector(
      Map<String, String> equalSchemes, Map<String, String> equalAuthorities) {
    this.equalSchemes = equalSchemes;
    this.equalAuthorities = equalAuthorities;
  }

  @Override
  public String getKey(String value) throws Exception {
    try {
      FileURI fileUri = new FileURI(new Path(value).toUri(), equalSchemes, equalAuthorities);
      return fileUri.getPath();
    } catch (Exception e) {
      LOG.warn("Uri convert to FileURI error! Uri is {}.", value, e);
      return INVALID_URI;
    }
  }
}

View on GitHub (pinned to 86d9c8fc54)