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

Thrown by the 'fileSize' function when the resolved URI scheme is not kestra://, file:// (local), or the namespace file scheme. It mirrors fileExists() but reads file attributes to return a size; the unsupported-scheme default branch throws IllegalArgumentException surfaced via getErrorMessage().

Source

Thrown at core/src/main/java/io/kestra/core/runners/pebble/functions/FileSizeFunction.java:40

    @Override
    protected Object fileFunction(EvaluationContext context, URI path, String namespace, String tenantId, Map<String, Object> args) throws IOException {
        return switch (path.getScheme()) {
            case StorageContext.KESTRA_SCHEME -> {
                FileAttributes fileAttributes = storageInterface.get().getAttributes(tenantId, namespace, path);
                yield fileAttributes.getSize();
            }
            case LocalPath.FILE_SCHEME -> {
                BasicFileAttributes fileAttributes = localPathFactory.get().createLocalPath().getAttributes(path);
                yield fileAttributes.size();
            }
            case Namespace.NAMESPACE_FILE_SCHEME -> {
                FileAttributes fileAttributes = namespaceFactory.get()
                    .of(tenantId, namespace, storageInterface.get())
                    .getFileMetadata(NamespaceFile.normalize(Path.of(path.getPath())));
                yield fileAttributes.getSize();
            }
            default -> throw new IllegalArgumentException(SCHEME_NOT_SUPPORTED_ERROR.formatted(path));
        };
    }

    @Override
    protected String getErrorMessage() {
        return ERROR_MESSAGE;
    }
}

View on GitHub (pinned to 823fada927)

Solutions

  1. Reference an internal storage object via its kestra:// URI (e.g. from outputs).
  2. Reference a namespace file using the namespace scheme, or a local file via file:// where supported.
  3. For remote files, download into internal storage first, then call fileSize() on the resulting URI.

Example fix

# before
size: "{{ fileSize('s3://bucket/key') }}"
# after
size: "{{ fileSize(outputs.download.uri) }}"
Defensive patterns

Strategy: validation

Validate before calling

# Validate the scheme before calling fileSize().
# {{ (uri starts with 'kestra://' or uri starts with 'file://' or uri starts with 'namespace://') ? fileSize(uri) : null }}

Prevention

When it happens

Trigger: Passing fileSize() an external URL (http/https/s3/gs) or any URI whose scheme is not one of the three handled. Also triggered by a malformed URI whose scheme parses as null/empty.

Common situations: Treating fileSize() as a generic remote-file size checker; passing an output reference that resolved to a non-storage URI; misconfiguring a path expression so it resolves to a plain string.

Related errors


AI-assisted analysis of kestra-io/kestra@823fada927 (2026-08-14). Data as JSON: /api/errors/08baac08e876a867. Report an issue: GitHub.