{"record":{"id":"57cf8526c34f4b39","repo":"apache/druid","slug":"argument-s-is-not-a-valid-uri","errorCode":null,"errorMessage":"Argument [%s] is not a valid URI","messagePattern":"Argument \\[(.+?)\\] is not a valid URI","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"server/src/main/java/org/apache/druid/catalog/model/CatalogUtils.java","lineNumber":244,"sourceCode":"  {\n    return stringListToUriList(stringToList(uris));\n  }\n\n  /**\n   * Convert a list of strings to a list of {@link URI} objects.\n   */\n  public static List<URI> stringListToUriList(List<String> list)\n  {\n    if (list == null) {\n      return null;\n    }\n    List<URI> uris = new ArrayList<>();\n    for (String strValue : list) {\n      try {\n        uris.add(new URI(strValue));\n      }\n      catch (URISyntaxException e) {\n        throw new IAE(StringUtils.format(\"Argument [%s] is not a valid URI\", strValue));\n      }\n    }\n    return uris;\n  }\n\n  /**\n   * Merge the properties for an object using a set of updates in a map. If the\n   * update value is {@code null}, then remove the property in the revised set. If the\n   * property is known, use the column definition to merge the values. Else, the\n   * update replaces any existing value.\n   * <p>\n   * This method does not validate the properties, except as needed to do a\n   * merge. A separate validation step is done on the final, merged object.\n   */\n  public static Map<String, Object> mergeProperties(\n      final Map<String, PropertyDefn<?>> properties,\n      final Map<String, Object> source,\n      final Map<String, Object> update","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/catalog/model/CatalogUtils.java#L226-L262","documentation":"CatalogUtils.stringListToUriList converts each string in a list to a java.net.URI and wraps any URISyntaxException into this IllegalArgumentException. It indicates one of the supplied URI strings cannot be parsed by the strict java.net.URI syntax rules (RFC 2396).","triggerScenarios":"Calling stringToUriList or stringListToUriList with any element containing characters illegal in URIs, e.g. unescaped spaces, \"|\", \"[\", \"]\", or a malformed scheme like \"C:\\\\path\" on Windows.","commonSituations":"Windows file paths pasted as URIs (\"C:\\data\\file.json\" instead of \"file:///C:/data/file.json\"); spaces in lookup URIs that are not percent-encoded; angle-bracketed or quoted URIs copied from docs.","solutions":["Fix the offending string to be a valid URI; use file:/// scheme with forward slashes for local paths.","Percent-encode illegal characters (spaces as %20) or encode with new URI(null, rawString, null) before parsing.","Identify the bad element from the message (it prints the exact string) and validate all entries with a quick URI parse beforehand."],"exampleFix":"// before\nlist.add(\"C:\\\\data\\\\lookups\\\\country.json\");\n// after\nlist.add(\"file:///C:/data/lookups/country.json\");","handlingStrategy":"validation","validationCode":"for (String u : uriStrings) {\n  try { new URI(u); } catch (URISyntaxException e) {\n    throw new IllegalArgumentException(\"Not a valid URI: \" + u);\n  }\n}","typeGuard":"boolean isValidUri(String s) { try { new URI(s); return true; } catch (URISyntaxException e) { return false; } }","tryCatchPattern":"try { List<URI> uris = CatalogUtils.stringToUriList(raw); ... } catch (IllegalArgumentException e) { // e.getMessage() names the exact bad string; fix or skip it }","preventionTips":["Use file:/// forward-slash form for local paths; never raw Windows paths.","Percent-encode spaces and reserved characters in URIs.","Run a pre-submission validation pass over all URI list properties."],"tags":["catalog","uri","parsing","invalid-argument"],"backgroundTag":"invalid-url-format","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}