{"record":{"id":"9270930fab9ba8e1","repo":"hpyhacking/peatio","slug":"when-regexp-must-not-be-global-or-sticky","errorCode":null,"errorMessage":"when() RegExp must not be global or sticky","messagePattern":"when\\(\\) RegExp must not be global or sticky","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/assets/javascripts/lib/angular-ui-router.js","lineNumber":1505,"sourceCode":"    if (isString(what)) what = $urlMatcherFactory.compile(what);\n\n    if (!handlerIsString && !isFunction(handler) && !isArray(handler))\n      throw new Error(\"invalid 'handler' in when()\");\n\n    var strategies = {\n      matcher: function (what, handler) {\n        if (handlerIsString) {\n          redirect = $urlMatcherFactory.compile(handler);\n          handler = ['$match', function ($match) { return redirect.format($match); }];\n        }\n        return extend(function ($injector, $location) {\n          return handleIfMatch($injector, handler, what.exec($location.path(), $location.search()));\n        }, {\n          prefix: isString(what.prefix) ? what.prefix : ''\n        });\n      },\n      regex: function (what, handler) {\n        if (what.global || what.sticky) throw new Error(\"when() RegExp must not be global or sticky\");\n\n        if (handlerIsString) {\n          redirect = handler;\n          handler = ['$match', function ($match) { return interpolate(redirect, $match); }];\n        }\n        return extend(function ($injector, $location) {\n          return handleIfMatch($injector, handler, what.exec($location.path()));\n        }, {\n          prefix: regExpPrefix(what)\n        });\n      }\n    };\n\n    var check = { matcher: $urlMatcherFactory.isMatcher(what), regex: what instanceof RegExp };\n\n    for (var n in check) {\n      if (check[n]) return this.rule(strategies[n](what, handler));\n    }","sourceCodeStart":1487,"sourceCodeEnd":1523,"githubUrl":"https://github.com/hpyhacking/peatio/blob/dab8641137c008928c835409342519bfef4eae7f/app/assets/javascripts/lib/angular-ui-router.js#L1487-L1523","documentation":"Error \"when() RegExp must not be global or sticky\" thrown in hpyhacking/peatio.","triggerScenarios":"Thrown at app/assets/javascripts/lib/angular-ui-router.js:1505 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the global ('g') and sticky ('y') flags from the RegExp passed to $urlRouterProvider.when()."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"dab8641137c008928c835409342519bfef4eae7f","analyzedAt":"2026-08-23T09:59:18.005Z","schemaVersion":2},"datasetVersion":"2026-08-23T13:39:53.451Z"}