apache/cassandra · error · IllegalArgumentException
%s is not a valid function resource name. It must end with "
Error message
%s is not a valid function resource name. It must end with "[]"
What it means
When FunctionResource.fromName sees a 3-part name, the last part must be the function name followed by a bracketed argument list. It throws IllegalArgumentException if the full name does not match the regex ^.+\[.*\]$, i.e. there is no trailing '[...]' argument block.
Source
Thrown at src/java/org/apache/cassandra/auth/FunctionResource.java:201
* @return FunctionResource instance matching the name.
*/
public static FunctionResource fromName(String name)
{
// Split the name into at most 3 parts.
// The last part is the function name + args list, the name might contains '/'
String[] parts = StringUtils.split(name, "/", 3);
if (!parts[0].equals(ROOT_NAME))
throw new IllegalArgumentException(String.format("%s is not a valid function resource name", name));
if (parts.length == 1)
return root();
if (parts.length == 2)
return keyspace(parts[1]);
if (!name.matches("^.+\\[.*\\]$"))
throw new IllegalArgumentException(String.format("%s is not a valid function resource name. It must end with \"[]\"", name));
String function = parts[2];
// The name must end with '[...]' block
int lastStartingBracketIndex = function.lastIndexOf('[');
String functionName = StringUtils.substring(function, 0, lastStartingBracketIndex);
String functionArgs = StringUtils.substring(function,
// excludes the wrapping brackets [ ]
lastStartingBracketIndex + 1,
function.length() - 1);
return function(parts[1], functionName, functionArgs.isEmpty() ? Collections.emptyList() : argsListFromString(functionArgs));
}
/**
* @return Printable name of the resource.
*/
public String getName()
{View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Append an argument list: 'functions/<ks>/<fn>[<type>,<type>]' — use '[]' for zero-arg overloads
- Construct via FunctionResource.function(keyspace, name, argTypes) so formatting is handled for you
- Inspect the stored name for truncation or missing brackets before parsing
Example fix
// before
FunctionResource r = FunctionResource.fromName("functions/ks/fn");
// after
FunctionResource r = FunctionResource.fromName("functions/ks/fn[int]"); Defensive patterns
Strategy: validation
Validate before calling
boolean hasArgsBlock(String name) {
return name.matches("^.+\\[.*\\]$");
} Try / catch
try { FunctionResource r = FunctionResource.fromName(name); } catch (IllegalArgumentException e) { log.error("function resource missing [args] block: {}", name); } Prevention
- Always append the bracketed argument list, using '[]' for zero-arg overloads
- Prefer FunctionResource.function(ks, name, argTypes) over string concatenation
- Check stored names for truncation before re-parsing
When it happens
Trigger: Parsing a name like 'functions/ks/fn' (missing '[]'), 'functions/ks/fn(' (unclosed bracket), or 'functions/ks/[int]' where the regex-match fails on the whole name rather than the third part.
Common situations: Building function resource names by hand and forgetting the argument list; overloads recorded without '[]'; truncation of stored permission strings; generating names from signatures without argument types.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- %s is not a valid data resource name
- %s is not a valid function resource name
- %s is not a valid JMX resource name
- In this context function name must be explictly qualified by
- %s function resource has no function name
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/8e56b97b25abe362.
Report an issue: GitHub.