neo4j/neo4j · error · IOException
Invalid URI provided:
Error message
Invalid URI provided:
What it means
SchemeFileSystemAbstraction.resolve(String) first matches the string against a URI scheme pattern (scheme:...). If the pattern matches, the string is parsed with new URI(resource); a URISyntaxException means the text looks like a schemed URI but is malformed, so the abstraction wraps the failure in this IOException instead of silently treating it as a local path.
Source
Thrown at community/cloud/src/main/java/org/neo4j/cloud/storage/SchemeFileSystemAbstraction.java:150
}
// no scheme: it's a local file path that the fallback can handle
return true;
}
@Override
public Path resolve(URI resource) throws IOException {
return internalResolve(resource.getScheme(), () -> resource);
}
@Override
public Path resolve(String resource) throws IOException {
final var matcher = SCHEME.matcher(resource);
if (matcher.matches()) {
return internalResolve(matcher.group(1), () -> {
try {
return new URI(resource);
} catch (URISyntaxException ex) {
throw new IOException("Invalid URI provided: " + resource, ex);
}
});
}
return Path.of(resource);
}
@Override
public StoreChannel open(Path fileName, Set<OpenOption> options) throws IOException {
if (fileName instanceof StoragePath path) {
//noinspection
return internalOpen(path, options);
}
return fs.open(fileName, options);
}
@OverrideView on GitHub (pinned to f213380f81)
Solutions
- URL-encode the path portion of the URI (spaces -> %20, brackets -> %5B/%5D) before calling resolve
- Construct a java.net.URI first with proper encoding and call resolve(URI) instead of resolve(String)
- If the value is genuinely a local path that merely resembles a scheme, rename or pass it via Path.of(...) directly
Example fix
// before
var path = fs.resolve("s3://bucket/my file.txt"); // throws IOException
// after
var path = fs.resolve("s3://bucket/my%20file.txt");
// or
var path = fs.resolve(URI.create("s3://bucket/my%20file.txt")); Defensive patterns
Strategy: validation
Validate before calling
private static final java.util.regex.Pattern SCHEME_LIKE = Pattern.compile("^([A-Za-z][A-Za-z0-9+.-]*):.*");
boolean willParse(String resource) {
var m = SCHEME_LIKE.matcher(resource);
return !m.matches() || isValidUri(resource);
}
boolean isValidUri(String s) {
try { new URI(s); return true; } catch (URISyntaxException e) { return false; }
} Try / catch
catch (IOException e) { if (e.getCause() instanceof URISyntaxException use) ... } — unwrap and report the exact syntax error position from URISyntaxException to the user/config key. Prevention
- Always URL-encode the path component of cloud URIs (spaces, brackets, non-ASCII)
- Prefer resolve(URI) built with URI.create over resolve(String) for schemed resources
- Validate configured URIs at startup with new URI(value) and fail fast with the config key name
When it happens
Trigger: Calling fileSystemAbstraction.resolve(resource) with a string that starts with a scheme-like prefix but contains illegal URI characters — unencoded spaces, brackets, or invalid escapes — e.g. "s3://bucket/my file.txt" or "gs://bucket/a[b].csv", or a syntactically broken scheme such as "1abc://x".
Common situations: Passing cloud URLs copy-pasted from browsers or consoles (spaces, unicode, query strings) without URL-encoding; Windows drive letters like "C:\data" accidentally matching the scheme regex; environment-specific path configs where a value was meant as a local path but contains a colon on the left.
Related errors
- StoragePaths do not have access to the remote system's block
- newWatchService
- Storage system already exists for the system URI :
- Unable to find the storage system for the system URI:
- Invalid tag. Tag must not be empty or null!
AI-assisted analysis of neo4j/neo4j@f213380f81 (2026-08-14).
Data as JSON: /api/errors/c55c08fb07e2141f.
Report an issue: GitHub.