{"record":{"id":"08baac08e876a867","repo":"kestra-io/kestra","slug":"cannot-process-the-uri-s-scheme-not-supported-08baac","errorCode":null,"errorMessage":"Cannot process the URI %s: scheme not supported.","messagePattern":"Cannot process the URI (.+?): scheme not supported\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/kestra/core/runners/pebble/functions/FileSizeFunction.java","lineNumber":40,"sourceCode":"\n    @Override\n    protected Object fileFunction(EvaluationContext context, URI path, String namespace, String tenantId, Map<String, Object> args) throws IOException {\n        return switch (path.getScheme()) {\n            case StorageContext.KESTRA_SCHEME -> {\n                FileAttributes fileAttributes = storageInterface.get().getAttributes(tenantId, namespace, path);\n                yield fileAttributes.getSize();\n            }\n            case LocalPath.FILE_SCHEME -> {\n                BasicFileAttributes fileAttributes = localPathFactory.get().createLocalPath().getAttributes(path);\n                yield fileAttributes.size();\n            }\n            case Namespace.NAMESPACE_FILE_SCHEME -> {\n                FileAttributes fileAttributes = namespaceFactory.get()\n                    .of(tenantId, namespace, storageInterface.get())\n                    .getFileMetadata(NamespaceFile.normalize(Path.of(path.getPath())));\n                yield fileAttributes.getSize();\n            }\n            default -> throw new IllegalArgumentException(SCHEME_NOT_SUPPORTED_ERROR.formatted(path));\n        };\n    }\n\n    @Override\n    protected String getErrorMessage() {\n        return ERROR_MESSAGE;\n    }\n}\n","sourceCodeStart":22,"sourceCodeEnd":49,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/runners/pebble/functions/FileSizeFunction.java#L22-L49","documentation":"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().","triggerScenarios":"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.","commonSituations":"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.","solutions":["Reference an internal storage object via its kestra:// URI (e.g. from outputs).","Reference a namespace file using the namespace scheme, or a local file via file:// where supported.","For remote files, download into internal storage first, then call fileSize() on the resulting URI."],"exampleFix":"# before\nsize: \"{{ fileSize('s3://bucket/key') }}\"\n# after\nsize: \"{{ fileSize(outputs.download.uri) }}\"","handlingStrategy":"validation","validationCode":"# Validate the scheme before calling fileSize().\n# {{ (uri starts with 'kestra://' or uri starts with 'file://' or uri starts with 'namespace://') ? fileSize(uri) : null }}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass only kestra://, file://, or namespace file URIs to fileSize().","Download remote files into internal storage before measuring size.","Reference outputs that resolve to internal storage URIs.","Do not use fileSize() for arbitrary remote URLs."],"tags":["pebble","file","filesize","storage","uri","scheme","validation"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}