{"record":{"id":"f2be342b0bff8d71","repo":"apache/cassandra","slug":"drop-function-s-matches-multiple-function-defin","errorCode":null,"errorMessage":"'DROP FUNCTION %s' matches multiple function definitions; specify the argument types by issuing a statement like 'DROP FUNCTION %s (type, type, ...)'. You can use cqlsh 'DESCRIBE FUNCTION %s' command to find all overloads","messagePattern":"'DROP FUNCTION (.+?)' matches multiple function definitions; specify the argument types by issuing a statement like 'DROP FUNCTION (.+?) \\(type, type, \\.\\.\\.\\)'\\. You can use cqlsh 'DESCRIBE FUNCTION (.+?)' command to find all overloads","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/statements/schema/DropFunctionStatement.java","lineNumber":100,"sourceCode":"        String name =\n            argumentsSpeficied\n          ? format(\"%s.%s(%s)\", keyspaceName, functionName, join(\", \", transform(arguments, CQL3Type.Raw::toString)))\n          : format(\"%s.%s\", keyspaceName, functionName);\n\n        Keyspaces schema = metadata.schema.getKeyspaces();\n        KeyspaceMetadata keyspace = schema.getNullable(keyspaceName);\n        if (null == keyspace)\n        {\n            if (ifExists)\n                return schema;\n\n            throw ire(\"Function '%s' doesn't exist\", name);\n        }\n\n        Collection<UserFunction> functions = keyspace.userFunctions.get(new FunctionName(keyspaceName, functionName));\n        if (functions.size() > 1 && !argumentsSpeficied)\n        {\n            throw ire(\"'DROP FUNCTION %s' matches multiple function definitions; \" +\n                      \"specify the argument types by issuing a statement like \" +\n                      \"'DROP FUNCTION %s (type, type, ...)'. You can use cqlsh \" +\n                      \"'DESCRIBE FUNCTION %s' command to find all overloads\",\n                      functionName, functionName, functionName);\n        }\n\n        arguments.stream()\n                 .filter(raw -> !raw.isImplicitlyFrozen() && raw.isFrozen())\n                 .findFirst()\n                 .ifPresent(t -> { throw ire(\"Argument '%s' cannot be frozen; remove frozen<> modifier from '%s'\", t, t); });\n\n        List<AbstractType<?>> argumentTypes = prepareArgumentTypes(keyspace.types);\n\n        Predicate<UserFunction> filter = UserFunctions.Filter.UDF;\n        if (argumentsSpeficied)\n            filter = filter.and(f -> f.typesMatch(argumentTypes));\n\n        UserFunction function = functions.stream().filter(filter).findAny().orElse(null);","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/statements/schema/DropFunctionStatement.java#L82-L118","documentation":"Multiple overloads of the named function exist in the keyspace and the DROP FUNCTION statement omitted the argument type list, making the target ambiguous. Cassandra requires explicit argument types to disambiguate.","triggerScenarios":"DROP FUNCTION fn (no type list) when two or more UDFs named fn with different signatures exist in the keyspace.","commonSituations":"Overloaded UDFs with same name/different types; shared migration scripts dropping by name; not using DESCRIBE FUNCTION to inspect overloads.","solutions":["Specify argument types: DROP FUNCTION ks.fn (type1, type2);","List overloads via cqlsh 'DESCRIBE FUNCTION ks.fn' or system_schema.functions","Keep overload sets minimal to avoid recurring ambiguity"],"exampleFix":"// before\nDROP FUNCTION sales.my_func;\n// after\nDROP FUNCTION sales.my_func (int, text);","handlingStrategy":"validation","validationCode":"const rows = await session.execute(\"SELECT argument_types, count(*) FROM system_schema.functions WHERE keyspace_name=? AND function_name=? GROUP BY argument_types\", [ks, name]); if (rows.rowLength > 1) throw new Error('Ambiguous: specify argument types');","typeGuard":null,"tryCatchPattern":"try { session.execute(ddl); } catch (e) { if (e instanceof InvalidQueryError && /matches multiple function definitions/.test(e.message)) { /* re-issue with explicit (type, ...) list */ } else throw e; }","preventionTips":["Always pass the argument type list when dropping potentially overloaded functions","Use DESCRIBE FUNCTION to enumerate overloads before dropping"],"tags":["cql","drop-function","ambiguous","overload","udf"],"backgroundTag":"ambiguous-reference","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}