{"record":{"id":"50b73c57aac692a7","repo":"kestra-io/kestra","slug":"cannot-process-the-uri-s-scheme-not-supported-50b73c","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/FileExistsFunction.java","lineNumber":30,"sourceCode":"\nimport io.pebbletemplates.pebble.template.EvaluationContext;\nimport jakarta.inject.Singleton;\n\n@Singleton\npublic class FileExistsFunction extends AbstractFileFunction {\n    public static final String NAME = \"fileExists\";\n    private static final String ERROR_MESSAGE = \"The 'fileExists' function expects an argument 'path' that is a path to the internal storage URI.\";\n\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 -> storageInterface.get().exists(tenantId, namespace, path);\n            case LocalPath.FILE_SCHEME -> localPathFactory.get().createLocalPath().exists(path);\n            case Namespace.NAMESPACE_FILE_SCHEME -> {\n                Namespace namespaceStorage = namespaceFactory.get().of(tenantId, namespace, storageInterface.get());\n                yield namespaceStorage.exists(NamespaceFile.normalize(Path.of(path.getPath())));\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":12,"sourceCodeEnd":39,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/runners/pebble/functions/FileExistsFunction.java#L12-L39","documentation":"Thrown by the 'fileExists' function when the resolved URI's scheme does not match kestra:// (StorageContext.KESTRA_SCHEME), the local file:// scheme (LocalPath.FILE_SCHEME), or the namespace file scheme (Namespace.NAMESPACE_FILE_SCHEME). The switch covers only those three; anything else falls to default and throws IllegalArgumentException, which the parent class surfaces using getErrorMessage().","triggerScenarios":"Passing fileExists() a URI like http://..., s3://..., gs://..., ftp://..., or a bare relative path that resolves to an unexpected scheme; passing an absolute filesystem path that does not map to the local file scheme.","commonSituations":"Confusing internal storage URIs with external URLs; using a plugin-specific storage URI; forgetting the kestra:// or namespace:// prefix; pasting a public URL instead of an internal storage reference.","solutions":["Use a kestra:// internal storage URI (e.g. from a task output) for files stored in Kestra's internal storage.","Use the namespace file scheme for files in the namespace files storage.","Use file:// with a local path only in worker contexts that support it.","If you need to check an external URL, fetch it first into internal storage and then call fileExists() on the resulting kestra:// URI."],"exampleFix":"# before\nexists: \"{{ fileExists('https://example.com/data.csv') }}\"\n# after - reference internal storage\nexists: \"{{ fileExists(outputs.write.outputFiles['data.csv']) }}\"","handlingStrategy":"validation","validationCode":"# Validate the URI scheme before calling fileExists(). Allowed: kestra://, file:// (local), and the namespace file scheme.\n# {{ (uri starts with 'kestra://' or uri starts with 'file://' or uri starts with 'namespace://') ? fileExists(uri) : false }}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only pass internal storage (kestra://), local (file://), or namespace file URIs to fileExists().","Fetch external resources into internal storage first.","Use task output references that yield kestra:// URIs.","Avoid treating fileExists() as a remote-URL checker."],"tags":["pebble","file","fileexists","storage","uri","scheme","validation"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}