kestra-io/kestra · error · IllegalArgumentException
The 'fileURI' function expects the 'revision' argument to be
Error message
The 'fileURI' function expects the 'revision' argument to be a valid integer.
What it means
Thrown by 'fileURI' when the optional 'revision' argument is provided but cannot be parsed by Integer.parseInt(). The function expects revision to be an integer version number of a namespace file; a non-numeric value is rejected before any storage lookup.
Source
Thrown at core/src/main/java/io/kestra/core/runners/pebble/functions/FileURIFunction.java:67
case Namespace.NAMESPACE_FILE_SCHEME -> getNamespaceFileURI(path, namespace, tenantId, args);
default -> throw new IllegalArgumentException(SCHEME_NOT_SUPPORTED_ERROR.formatted(path));
};
}
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
- Provide revision as an integer literal or an expression that resolves to an integer string, e.g. fileURI(path, revision=3).
- If you do not need a specific revision, omit the 'revision' argument entirely to get the current version.
- Validate upstream expressions that feed 'revision' to ensure they yield whole numbers.
Example fix
# before
uri: "{{ fileURI('namespace:///f.yaml', revision='latest') }}"
# after - numeric revision, or omit it
uri: "{{ fileURI('namespace:///f.yaml', revision=2) }}" Defensive patterns
Strategy: validation
Validate before calling
# Confirm 'revision' parses as an integer before calling fileURI().
# {{ (revision matches '^\\d+$') ? fileURI(path, revision=revision) : fileURI(path) }} Prevention
- Pass 'revision' as an integer literal or an integer-yielding expression.
- Omit 'revision' to get the current version when a specific one is not needed.
- Validate upstream expressions that feed 'revision' produce whole numbers.
- Avoid semantic version labels or floats for 'revision'.
When it happens
Trigger: Passing revision='latest', revision='v2', revision=2.5 (a float string), or revision from an input/variable that resolved to a non-integer string.
Common situations: Passing a semantic version label instead of the numeric revision; passing a float because an upstream expression produced a decimal; binding revision to a free-text input.
Related errors
- Path must not contain '../'
- Revision {revision} of file '{filePath}' was not found in na
- Cannot process the URI %s: scheme not supported.
- Cannot process the URI %s: scheme not supported.
- Cannot process the URI %s: scheme not supported.
AI-assisted analysis of kestra-io/kestra@823fada927 (2026-08-14).
Data as JSON: /api/errors/38149431136a7dec.
Report an issue: GitHub.