{"record":{"id":"ba06965895409a95","repo":"amark/gun","slug":"cannot-override-existing-verifyclient-option-in-w","errorCode":null,"errorMessage":"Cannot override existing verifyClient option in `ws` configuration.","messagePattern":"Cannot override existing verifyClient option in `ws` configuration\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/verify.js","lineNumber":63,"sourceCode":"Gun.on('opt', function(context) {\n    var opt = context.opt || {};\n    var ws = opt.ws || {};\n\n    if (!opt.verify) {\n        this.to.next(context);\n        return;\n    }\n\n    /**\n     *  verify when instantiating Gun can contain the following keys:\n     *      allowOrigins: Array|RegExp|String\n     *      auth:         String|Function\n     *      authKey:      String\n     *      check:        Function\n     */\n    var verify = opt.verify;\n    if (ws.verifyClient && !verify.override) {\n        throw Error('Cannot override existing verifyClient option in `ws` configuration.');\n    }\n\n    /**\n     * Attach a verifyClient to the WS configuration.\n     * \n     * @param  {Object}   info      Request information\n     * @param  {Function} callback  Called when verification is complete\n     */\n    ws.verifyClient = function(info, callback) {\n\n        // Callback Definitions\n        var errorCallback = (errorCode, message) => {\n            callback(false, errorCode, message);\n        };\n        var successCallback = () => {\n            callback(true);\n        };\n","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/amark/gun/blob/552227599d47ba0493824b7fcf8a00c8cd6404ba/lib/verify.js#L45-L81","documentation":"Thrown in the Gun 'opt' hook when the user both passes a verify option (opt.verify) and already has a verifyClient function in the WebSocket options (opt.ws.verifyClient). Since this module installs its own verifyClient for origin/auth checking, a pre-existing one would be silently replaced; the guard aborts startup unless the caller explicitly sets verify.override to acknowledge the replacement.","triggerScenarios":"Thrown at lib/verify.js:63 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the verifyClient key from the ws options and let this module configure it from opt.verify (allowOrigins, auth, authKey, check)","If replacing the existing verifyClient is intentional, set verify: {override: true} in the Gun options","Merge your custom checks into the verify.check function instead of a raw ws.verifyClient"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"552227599d47ba0493824b7fcf8a00c8cd6404ba","analyzedAt":"2026-09-02T18:40:58.370Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}