nodejs/node · error · TypeError

Got error while preparing results_regexp: parent.results_reg

Error message

Got error while preparing results_regexp: parent.results_regexp='%s' suite.name='%s' suite='%s', error: %s

What it means

When a child suite omits results_regexp but inherits from a parent that has one, GraphConfig formats the parent regexp with the escaped child name via `%`. This requires the parent regexp to contain exactly one `%s` placeholder and be a string. A missing/malformed placeholder (or a non-string regexp) raises TypeError, which GraphConfig re-wraps with full context.

Source

Thrown at deps/v8/tools/run_perf.py:415

    self.timeout = suite.get('timeout', parent.timeout)
    self.timeout = suite.get('timeout_%s' % arch, self.timeout)
    self.units = suite.get('units', parent.units)
    self.total = suite.get('total', parent.total)
    self.results_processor = suite.get(
        'results_processor', parent.results_processor)
    self.process_size = suite.get('process_size', parent.process_size)

    # A regular expression for results. If the parent graph provides a
    # regexp and the current suite has none, a string place holder for the
    # suite name is expected.
    # TODO(machenbach): Currently that makes only sense for the leaf level.
    # Multiple place holders for multiple levels are not supported.
    self.results_regexp = suite.get('results_regexp', None)
    if self.results_regexp is None and parent.results_regexp:
      try:
        self.results_regexp = parent.results_regexp % re.escape(suite['name'])
      except TypeError as e:
        raise TypeError(
            "Got error while preparing results_regexp: "
            "parent.results_regexp='%s' suite.name='%s' suite='%s', error: %s" %
            (parent.results_regexp, suite['name'], str(suite)[:100], e))

    self.results_default = suite.get('results_default', None)

    # A similar regular expression for the standard deviation (optional).
    if parent.stddev_regexp:
      stddev_default = parent.stddev_regexp % re.escape(suite['name'])
    else:
      stddev_default = None
    self.stddev_regexp = suite.get('stddev_regexp', stddev_default)

  @property
  def name(self):
    return '/'.join(self.graphs)

  def __str__(self):

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Add exactly one `%s` to the parent's results_regexp so child-name substitution works.
  2. If the parent regexp should be literal, give each child its own results_regexp instead of relying on inheritance.
  3. Validate the suite JSON schema (placeholder counts) before running run_perf.py.

Example fix

// before
"results_regexp": "Runtime: ([0-9]+)"
// after
"results_regexp": "%s\\.Runtime: ([0-9]+)"
Defensive patterns

Strategy: validation

Validate before calling

import re
def validate_inherited_regexp(parent_regexp):
    if not isinstance(parent_regexp, str):
        raise TypeError('parent results_regexp must be a string')
    if parent_regexp.count('%s') != 1:
        raise TypeError(
            f'parent results_regexp needs exactly one %s placeholder; '
            f'got {parent_regexp.count("%s")}: {parent_regexp!r}')
    # ensure the placeholder actually formats cleanly
    parent_regexp % 'CHILD'

Type guard

def is_valid_parent_regexp(r):
    return isinstance(r, str) and r.count('%s') == 1

Try / catch

try:
    self.results_regexp = parent.results_regexp % re.escape(suite['name'])
except TypeError as e:
    raise TypeError(f'bad parent results_regexp for suite {suite["name"]!r}: {e}') from e

Prevention

When it happens

Trigger: A suite tree where parent.results_regexp has zero `%s` placeholders (or multiple, or is non-string) and a child relies on inheritance.

Common situations: Authoring a new perf-suite that inherits a literal parent regexp with no placeholder; typo like `%d`; non-string value slipped into results_regexp.

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/c957bbf3c6d36ffe. Report an issue: GitHub.