hpyhacking/peatio · error

Unbalanced capture group in route '{}'

Error message

Unbalanced capture group in route '{}'

What it means

Error "Unbalanced capture group in route '{}'" thrown in hpyhacking/peatio.

Source

Thrown at app/assets/javascripts/lib/angular-ui-router.js:830

 *   x: '1', q: 'hello'
 * });
 * // returns { id: 'bob', q: 'hello', r: null }
 * </pre>
 *
 * @param {string} path  The URL path to match, e.g. `$location.path()`.
 * @param {Object} searchParams  URL search parameters, e.g. `$location.search()`.
 * @returns {Object}  The captured parameter values.
 */
UrlMatcher.prototype.exec = function (path, searchParams) {
  var m = this.regexp.exec(path);
  if (!m) return null;
  searchParams = searchParams || {};

  var params = this.parameters(), nTotal = params.length,
    nPath = this.segments.length - 1,
    values = {}, i, cfg, param;

  if (nPath !== m.length - 1) throw new Error("Unbalanced capture group in route '" + this.source + "'");

  for (i = 0; i < nPath; i++) {
    param = params[i];
    cfg = this.params[param];
    values[param] = cfg.$value(m[i + 1]);
  }
  for (/**/; i < nTotal; i++) {
    param = params[i];
    cfg = this.params[param];
    values[param] = cfg.$value(searchParams[param]);
  }

  return values;
};

/**
 * @ngdoc function
 * @name ui.router.util.type:UrlMatcher#parameters

View on GitHub (pinned to dab8641137)

Solutions

  1. Balance the parentheses in the route's regular expression: close every capture group, and escape literal parentheses as \( and \).

When it happens

Trigger: Thrown at app/assets/javascripts/lib/angular-ui-router.js:830 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hpyhacking/peatio@dab8641137 (2026-08-23). Data as JSON: /api/errors/f6559d8478427cb4. Report an issue: GitHub.