nodejs/node · error · Exception

%s only allows TraceConfig and LeafTraceConfig as child conf

Error message

%s only allows TraceConfig and LeafTraceConfig as child configs.

What it means

Thrown by TraceConfig.AppendChild in V8's run_perf.py performance-test harness when a node is attached to a TraceConfig whose class is neither TraceConfig nor LeafTraceConfig. The performance suite is a tree (GraphConfig -> TraceConfig -> LeafTraceConfig), and TraceConfig deliberately restricts its children to those two types so the tree's shape stays valid for result aggregation (the geometric-mean 'Total' trace in ResultsTracker assumes LeafTraceConfig leaves).

Source

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

      # Produce total metric only when all traces have produced results.
      if len(self.children) != len(results_for_total):
        result_tracker.AddError(
            'Not all traces have produced results. Can not compute total for '
            '%s.' % self.name)
        return

      # Calculate total as a the geometric mean for results from all traces.
      total_trace = LeafTraceConfig(
          {
              'name': 'Total',
              'units': self.children[0].units
          }, self, self.arch)
      result_tracker.AddTraceResult(total_trace,
                                    GeometricMean(results_for_total), '')

  def AppendChild(self, node):
    if node.__class__ not in (TraceConfig, LeafTraceConfig):
      raise Exception(
          "%s only allows TraceConfig and LeafTraceConfig as child configs." %
          type(self).__name__)
    super(TraceConfig, self).AppendChild(node)


class RunnableConfig(TraceConfig):
  """Represents a runnable suite definition (i.e. has a main file).
  """
  def __init__(self, suite, parent, arch):
    super(RunnableConfig, self).__init__(suite, parent, arch)
    self.arch = arch
    assert self.main, "No main js file provided"
    if not self.owners:
      logging.error("No owners provided for %s" % self.name)

  def ChangeCWD(self, suite_path):
    """Changes the cwd to to path defined in the current graph.

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Inspect the suite JSON: every child under a trace-producing node must resolve to TraceConfig or LeafTraceConfig, not GraphConfig/RunnableConfig.
  2. Check MakeGraphConfig selection rules (the 'main'/'tests' branching around run_perf.py:640) to see which class your child suite resolves to and adjust the keys so it maps to TraceConfig/LeafTraceConfig.
  3. If you authored a new config subclass, either register it in the allowed tuple in AppendChild or attach it under GraphConfig (which accepts arbitrary children) instead of TraceConfig.

Example fix

// before (suite JSON forces RunnableConfig under a TraceConfig)
{ "name":"x", "main":"x.js", "tests":[ {"name":"sub"} ] }
// after (drop 'main' so children resolve to TraceConfig/LeafTraceConfig, or move the block under a GraphConfig parent)
{ "name":"x", "tests":[ {"name":"sub"} ] }
Defensive patterns

Strategy: validation

Validate before calling

from tools.run_perf import TraceConfig, LeafTraceConfig
def safe_append(parent, child):
    assert isinstance(parent, TraceConfig), 'parent must be TraceConfig'
    if child.__class__ not in (TraceConfig, LeafTraceConfig):
        raise ValueError(f'Refusing to append {child.__class__.__name__}; rebuild suite so child resolves to TraceConfig/LeafTraceConfig')
    parent.AppendChild(child)

Type guard

def is_valid_trace_child(node) -> bool:
    return node.__class__ in (TraceConfig, LeafTraceConfig)

Try / catch

null

Prevention

When it happens

Trigger: Calling node.AppendChild(someNode) where someNode.__class__ is not exactly TraceConfig or LeafTraceConfig (e.g. a GraphConfig, VariantConfig, or RunnableConfig attached to a TraceConfig parent). This is normally driven by BuildGraphConfigs misclassifying a suite dict, e.g. a suite entry that has both 'main' and 'tests' but whose resolved class is RunnableConfig being appended under a TraceConfig.

Common situations: See trigger scenarios.

Related errors


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