{"record":{"id":"c957bbf3c6d36ffe","repo":"nodejs/node","slug":"got-error-while-preparing-results-regexp-parent-r","errorCode":null,"errorMessage":"Got error while preparing results_regexp: parent.results_regexp='%s' suite.name='%s' suite='%s', error: %s","messagePattern":"Got error while preparing results_regexp: parent\\.results_regexp='(.+?)' suite\\.name='(.+?)' suite='(.+?)', error: (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"deps/v8/tools/run_perf.py","lineNumber":415,"sourceCode":"    self.timeout = suite.get('timeout', parent.timeout)\n    self.timeout = suite.get('timeout_%s' % arch, self.timeout)\n    self.units = suite.get('units', parent.units)\n    self.total = suite.get('total', parent.total)\n    self.results_processor = suite.get(\n        'results_processor', parent.results_processor)\n    self.process_size = suite.get('process_size', parent.process_size)\n\n    # A regular expression for results. If the parent graph provides a\n    # regexp and the current suite has none, a string place holder for the\n    # suite name is expected.\n    # TODO(machenbach): Currently that makes only sense for the leaf level.\n    # Multiple place holders for multiple levels are not supported.\n    self.results_regexp = suite.get('results_regexp', None)\n    if self.results_regexp is None and parent.results_regexp:\n      try:\n        self.results_regexp = parent.results_regexp % re.escape(suite['name'])\n      except TypeError as e:\n        raise TypeError(\n            \"Got error while preparing results_regexp: \"\n            \"parent.results_regexp='%s' suite.name='%s' suite='%s', error: %s\" %\n            (parent.results_regexp, suite['name'], str(suite)[:100], e))\n\n    self.results_default = suite.get('results_default', None)\n\n    # A similar regular expression for the standard deviation (optional).\n    if parent.stddev_regexp:\n      stddev_default = parent.stddev_regexp % re.escape(suite['name'])\n    else:\n      stddev_default = None\n    self.stddev_regexp = suite.get('stddev_regexp', stddev_default)\n\n  @property\n  def name(self):\n    return '/'.join(self.graphs)\n\n  def __str__(self):","sourceCodeStart":397,"sourceCodeEnd":433,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/v8/tools/run_perf.py#L397-L433","documentation":"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.","triggerScenarios":"A suite tree where parent.results_regexp has zero `%s` placeholders (or multiple, or is non-string) and a child relies on inheritance.","commonSituations":"Authoring a new perf-suite that inherits a literal parent regexp with no placeholder; typo like `%d`; non-string value slipped into results_regexp.","solutions":["Add exactly one `%s` to the parent's results_regexp so child-name substitution works.","If the parent regexp should be literal, give each child its own results_regexp instead of relying on inheritance.","Validate the suite JSON schema (placeholder counts) before running run_perf.py."],"exampleFix":"// before\n\"results_regexp\": \"Runtime: ([0-9]+)\"\n// after\n\"results_regexp\": \"%s\\\\.Runtime: ([0-9]+)\"","handlingStrategy":"validation","validationCode":"import re\ndef validate_inherited_regexp(parent_regexp):\n    if not isinstance(parent_regexp, str):\n        raise TypeError('parent results_regexp must be a string')\n    if parent_regexp.count('%s') != 1:\n        raise TypeError(\n            f'parent results_regexp needs exactly one %s placeholder; '\n            f'got {parent_regexp.count(\"%s\")}: {parent_regexp!r}')\n    # ensure the placeholder actually formats cleanly\n    parent_regexp % 'CHILD'","typeGuard":"def is_valid_parent_regexp(r):\n    return isinstance(r, str) and r.count('%s') == 1","tryCatchPattern":"try:\n    self.results_regexp = parent.results_regexp % re.escape(suite['name'])\nexcept TypeError as e:\n    raise TypeError(f'bad parent results_regexp for suite {suite[\"name\"]!r}: {e}') from e","preventionTips":["Schema-validate suite JSON before running run_perf.py.","Document that parent-level regexps must contain exactly one %s."],"tags":["run-perf","regexp","config","v8","benchmarks"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}