apache/cassandra · error · IllegalArgumentException

An error was encountered when looking up function…

Error message

An error was encountered when looking up function definition: 

What it means

constructFunctionResource resolves 'functions/<keyspace>/<function>' via FunctionResource.fromName; a ConfigurationException means the function or keyspace name is not a valid/existing resource name. The ConfigurationException is rethrown as IllegalArgumentException with this message.

Solutions

  1. Verify the function exists: SELECT function_name FROM system_schema.functions WHERE keyspace_name = '<ks>';
  2. Correct the spelling of --function / --functions-in-keyspace
  3. If the function was already dropped, invalidate the keyspace-level resource instead (--functions-in-keyspace alone)

Example fix

// before
nodetool invalidatepermissionscache --function myfn --functions-in-keyspace wrong_ks
// after
nodetool invalidatepermissionscache --function myfn --functions-in-keyspace my_ks
Defensive patterns

Strategy: validation

Validate before calling

const exists = await query("SELECT function_name FROM system_schema.functions WHERE keyspace_name = ? AND function_name = ?", ks, fn);
if (empty(exists)) throw new Error(`function ${ks}.${fn} not found`);

Try / catch

try { runNodetool('invalidatepermissionscache', '--function', fn, '--functions-in-keyspace', ks); } catch (IllegalArgumentException e) { if (e.message.includes('looking up function definition')) { /* correct names */ } }

Prevention

When it happens

Trigger: `nodetool invalidatepermissionscache --function <name> --functions-in-keyspace <ks>` where the function does not exist or the name contains invalid characters/overloaded signatures the parser cannot resolve.

Common situations: Typo in function name; function dropped before cache invalidation; wrong keyspace; function names with special characters needing escaping.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/eb331623afb53e26. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/tools/nodetool/InvalidatePermissionsCache.java:181

            if (StringUtils.isNotEmpty(mBean))
                resourceNames.add(JMXResource.mbean(mBean).getName());

            if (resourceNames.isEmpty())
                throw new IllegalArgumentException("No resource options specified");

            for (String resourceName : resourceNames)
                probe.invalidatePermissionsCache(roleName, resourceName);
        }
    }

    private String constructFunctionResource(String functionsInKeyspace, String function) {
        try
        {
            return FunctionResource.fromName("functions/" + functionsInKeyspace + '/' + function).getName();
        } catch (ConfigurationException e)
        {
            throw new IllegalArgumentException("An error was encountered when looking up function definition: " + e.getMessage());
        }
    }
}

View on GitHub (pinned to 88fd0f6a0e)