kestra-io/kestra · error · FileNotFoundException

Revision {revision} of file '{filePath}' was not found in na

Error message

Revision {revision} of file '{filePath}' was not found in namespace '{namespace}'.

What it means

Thrown by 'fileURI' when namespaceStorage.getFileContent(filePath, revision) raises FileNotFoundException, re-thrown with a message naming the revision, file path, and namespace. It confirms that the requested revision does not exist in namespace file storage; note the literal string uses concatenation (not the {placeholder} syntax), so the message includes the actual values.

Source

Thrown at core/src/main/java/io/kestra/core/runners/pebble/functions/FileURIFunction.java:72

    private String getNamespaceFileURI(URI path, String namespace, String tenantId, Map<String, Object> args) throws IOException {
        String pathStr = path.getPath();
        if (pathStr.contains("../")) {
            throw new IllegalArgumentException("Path must not contain '../'");
        }
        Namespace namespaceStorage = namespaceFactory.get().of(tenantId, namespace, storageInterface.get());
        Path filePath = NamespaceFile.normalize(Path.of(pathStr));

        if (args.containsKey(REVISION)) {
            Integer revision;
            try {
                revision = Integer.parseInt(args.get(REVISION).toString());
            } catch (NumberFormatException e) {
                throw new IllegalArgumentException("The 'fileURI' function expects the 'revision' argument to be a valid integer.");
            }
            try {
                namespaceStorage.getFileContent(filePath, revision).close();
            } catch (FileNotFoundException e) {
                throw new FileNotFoundException("Revision " + revision + " of file '" + filePath + "' was not found in namespace '" + namespace + "'.");
            }
            NamespaceFile namespaceFile = NamespaceFile.of(namespace, filePath, revision);
            return namespaceFile.uri().toString();
        } else {
            NamespaceFile namespaceFile = namespaceStorage.get(filePath);
            return namespaceFile.uri().toString();
        }
    }

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

View on GitHub (pinned to 823fada927)

Solutions

  1. Omit 'revision' to get the current version, or look up the valid revisions of the namespace file first.
  2. Confirm the file path is correct and lives in the namespace you are referencing.
  3. If you need a pinned revision, verify it exists (e.g. via the UI/API namespace files history) before referencing it.

Example fix

# before
uri: "{{ fileURI('namespace:///gone.yaml', revision=99) }}"
# after - use current version
uri: "{{ fileURI('namespace:///gone.yaml') }}"
Defensive patterns

Strategy: validation

Validate before calling

# Verify the revision exists (or omit it) before calling fileURI() with a pinned revision.
# {{ hasRevision ? fileURI(path, revision=rev) : fileURI(path) }}

Prevention

When it happens

Trigger: Requesting a revision number that does not exist for the namespace file (too high, or a revision of a file that has since been deleted); pointing at a file path that has no revisions; passing a revision for a file that lives in a different namespace.

Common situations: Hard-coding a revision from an earlier deployment after the file was recreated/deleted; using an execution variable that resolved to a stale revision; namespace mismatch where the file exists elsewhere.

Related errors


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