kestra-io/kestra · error · IllegalArgumentException
Cannot process the URI %s: scheme not supported.
Error message
Cannot process the URI %s: scheme not supported.
What it means
Inside AbstractFileFunction.execute(), after checking the supported schemes (kestra:///, file://, namespace://), if the string still matches the generic URI pattern (scheme:something) an IllegalArgumentException is thrown with 'Cannot process the URI %s: scheme not supported.' The surrounding catch wraps it into a PebbleException carrying e.getMessage().
Source
Thrown at core/src/main/java/io/kestra/core/runners/pebble/functions/AbstractFileFunction.java:91
Map<String, String> flow = (Map<String, String>) context.getVariable("flow");
String tenantId = flow.get(TENANT_ID);
if (path instanceof URI uri) {
fileUri = uri;
namespace = checkAllowedFileAndReturnNamespace(context, fileUri);
} else if (path instanceof String str) {
if (str.startsWith(KESTRA_SCHEME)) {
fileUri = URI.create(str);
namespace = checkAllowedFileAndReturnNamespace(context, fileUri);
} else if (str.startsWith(LocalPath.FILE_PROTOCOL)) {
fileUri = URI.create(str);
namespace = checkEnabledLocalFileAndReturnNamespace(args, flow);
} else if (str.startsWith(Namespace.NAMESPACE_FILE_SCHEME)) {
fileUri = URI.create(str);
namespace = checkedAllowedNamespaceAndReturnNamespace(args, fileUri, tenantId, flow);
} else if (URI_PATTERN.matcher(str).matches()) {
// it is an unsupported URI
throw new IllegalArgumentException(SCHEME_NOT_SUPPORTED_ERROR.formatted(str));
} else {
fileUri = URI.create(Namespace.NAMESPACE_FILE_SCHEME + ":///" + str);
namespace = (String) Optional.ofNullable(args.get(NAMESPACE)).orElse(flow.get(NAMESPACE));
namespaceService.get().checkAllowedNamespace(tenantId, namespace, tenantId, flow.get(NAMESPACE));
}
} else {
throw new PebbleException(null, "Unable to read the file " + path, lineNumber, self.getName());
}
return fileFunction(context, fileUri, namespace, tenantId, args);
} catch (IOException | IllegalArgumentException e) { // IllegalArgumentException may be thrown for path traversal, catch it to have proper error handling
throw new PebbleException(e, e.getMessage(), lineNumber, self.getName());
}
}
@Override
public List<String> getArgumentNames() {
return List.of(PATH, NAMESPACE);
}View on GitHub (pinned to 823fada927)
Solutions
- Use an HTTP task (e.g. io.kestra.plugin.core.http.Request) to fetch remote URLs, then read the downloaded internal-storage URI.
- Convert remote content into a kestra:/// internal storage URI before passing to read().
- For namespace files use the namespace:// scheme; for local worker files use file:// (if enabled).
Example fix
// before
{{ read('https://example.com/data.json') }}
// after
id: fetch
namespace: company.team
tasks:
- id: http
type: io.kestra.plugin.core.http.Request
uri: https://example.com/data.json
- id: use
type: io.kestra.plugin.core.log.Log
message: "{{ read(outputs.http.body) }}" Defensive patterns
Strategy: validation
Validate before calling
// Pebble: only kestra:///, file://, namespace:// are allowed
{% set u = outputs.x.uri %}{{ (u starts with 'kestra://' or u starts with 'namespace://' or u starts with 'file://') ? read(u) : '' }} Prevention
- read() is internal-storage only; use an HTTP task for remote URLs.
- Validate the scheme is kestra/file/namespace before calling read.
- Convert remote content into internal storage first.
When it happens
Trigger: Passing an http/https/ftp/s3/custom-scheme URI to read(): {{ read('https://example.com/data.json') }}. Any scheme other than kestra, file, or namespace triggers it.
Common situations: Trying to read a remote URL directly with read() (which is internal-storage only); pasting a public URL expecting an HTTP fetch; plugin confusion about which function fetches remote content.
Related errors
- Unable to read the file '{path}' as it is not an execution f
- getErrorMessage() [abstract: subclass-defined ERROR_MESSAGE]
- Unable to read the file {path}
- IOException|IllegalArgumentException: e.getMessage()
- You cannot set a namespace both as the function argument and
AI-assisted analysis of kestra-io/kestra@823fada927 (2026-08-14).
Data as JSON: /api/errors/aa8c5ce15d5cec43.
Report an issue: GitHub.