{"record":{"id":"35f22308f8e89b3d","repo":"WordPress/WordPress","slug":"third-argument-must-be-a-function","errorCode":null,"errorMessage":"Third argument must be a Function","messagePattern":"Third argument must be a Function","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"wp-includes/js/clipboard.js","lineNumber":627,"sourceCode":" * Validates all params and calls the right\n * listener function based on its target type.\n *\n * @param {String|HTMLElement|HTMLCollection|NodeList} target\n * @param {String} type\n * @param {Function} callback\n * @return {Object}\n */\nfunction listen(target, type, callback) {\n    if (!target && !type && !callback) {\n        throw new Error('Missing required arguments');\n    }\n\n    if (!is.string(type)) {\n        throw new TypeError('Second argument must be a String');\n    }\n\n    if (!is.fn(callback)) {\n        throw new TypeError('Third argument must be a Function');\n    }\n\n    if (is.node(target)) {\n        return listenNode(target, type, callback);\n    }\n    else if (is.nodeList(target)) {\n        return listenNodeList(target, type, callback);\n    }\n    else if (is.string(target)) {\n        return listenSelector(target, type, callback);\n    }\n    else {\n        throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');\n    }\n}\n\n/**\n * Adds an event listener to a HTML element","sourceCodeStart":609,"sourceCodeEnd":645,"githubUrl":"https://github.com/WordPress/WordPress/blob/f37eb7ab386ba0785b153f64c9c4451a8df9d9e3/wp-includes/js/clipboard.js#L609-L645","documentation":"Error \"Third argument must be a Function\" thrown in WordPress/WordPress.","triggerScenarios":"Thrown at wp-includes/js/clipboard.js:627 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f37eb7ab386ba0785b153f64c9c4451a8df9d9e3","analyzedAt":"2026-08-17T02:58:14.809Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}