MySQL raises this error when an audit_log UDF is invoked with the wrong number of arguments.
ER_AUDIT_LOG_UDF_INVALID_ARGUMENT_COUNT (MySQL error 3215) occurs when audit_log_read() or audit_log_write() are called with too few or too many parameters. Match the exact argument count defined in the plugin or disable the call to resolve the issue.
ER_AUDIT_LOG_UDF_INVALID_ARGUMENT_COUNT
MySQL raises error 3215 with the condition name ER_AUDIT_LOG_UDF_INVALID_ARGUMENT_COUNT when a user defined function that interfaces with the audit_log plugin receives a wrong number of arguments. The server stops executing the statement and returns SQLSTATE HY000.
The problem appears in versions 5.7.22 and later, because that release introduced argument validation for the audit_log UDFs. Fixing it is important because audit logging may silently fail if the function call is not corrected.
The error is triggered when the audit_log_read() or audit_log_write() functions are called with fewer or more parameters than the plugin expects. The check runs before execution, so even privileged users will see the failure.
Mismatched plugin version, stored procedures that wrap the UDF, and copy pasted examples written for older MySQL versions are frequent sources.
Count the parameters required by the audit function and make sure every invocation supplies exactly that number and in the correct order. After correcting the call, rerun the statement to confirm the error disappears.
If you no longer need manual audit_log_* calls, uninstall or disable the plugin to eliminate the possibility of misuse.
Developers often omit the final JSON parameter in audit_log_write(), causing the function to fail in scripts. Adding the missing JSON argument resolves the issue.
Automated migration tools can add extra commas that result in an empty argument; removing the stray comma restores proper syntax.
Document the approved function signatures in a shared Galaxy Collection so every team member can reuse the correct example.
Create unit tests that call the audit functions during CI; failures surface immediately when the signature changes after an upgrade.
Error 3214 ER_AUDIT_LOG_UNSUPPORTED_FACILITY appears when a facility not supported by the audit log plugin is used. Provide a valid facility string to fix.
Error 3220 ER_AUDIT_LOG_PASSWORD_INVALID indicates an invalid password for encrypted audit logs. Update the audit_log_encryption_password file to resolve.
Calling audit_log_read() with only one argument instead of the required two immediately triggers error 3215.
Tutorials written before MySQL 5.7.22 show audit_log_write() with missing JSON argument, leading to the invalid argument count error after upgrade.
Deploying a newer audit_log plugin binary on an older server changes the expected signature and causes argument validation to fail.
Raised when an unsupported audit facility name is passed; supply a valid facility.
Indicates an invalid encryption password for audit logs; update the password file.
Appears when the audit log format string is not valid JSON; ensure proper JSON syntax.
The function needs exactly three arguments: facility, event, and a JSON payload.
Yes. Run UNINSTALL PLUGIN audit_log; or start MySQL with --skip_audit_log if auditing is not needed.
Upgrading does not rewrite your code. You still need to adjust every audit_log_* call to use the correct signature.
Galaxy Collections let teams share a vetted snippet for audit_log_write(), ensuring everyone reuses the correct argument count.