{"record":{"id":"a1c943efbdad18db","repo":"nodejs/node","slug":"s-cannot-have-child-configs","errorCode":null,"errorMessage":"%s cannot have child configs.","messagePattern":"(.+?) cannot have child configs\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"deps/v8/tools/run_perf.py","lineNumber":465,"sourceCode":"      assert \"name\" in variant, \\\n          \"Variant must have 'name' property: \" + str(variant)[:100]\n      assert len(variant) >= 2, \\\n          \"Variant must define other properties than 'name': \" + str(variant)\n\n\nclass LeafTraceConfig(GraphConfig):\n  \"\"\"Represents a leaf in the suite tree structure.\"\"\"\n  def __init__(self, suite, parent, arch):\n    super(LeafTraceConfig, self).__init__(suite, parent, arch)\n    assert self.results_regexp\n    if '%s' in self.results_regexp:\n      raise Exception(\n          \"results_regexp at the wrong level. \"\n          \"Regexp should not contain '%%s': results_regexp='%s' name=%s\" %\n          (self.results_regexp, self.name))\n\n  def AppendChild(self, node):\n    raise Exception(\"%s cannot have child configs.\" % type(self).__name__)\n\n  def ConsumeOutput(self, output, result_tracker):\n    \"\"\"Extracts trace results from the output.\n\n    Args:\n      output: Output object from the test run.\n      result_tracker: Result tracker to be updated.\n\n    Returns:\n      The raw extracted result value or None if an error occurred.\n    \"\"\"\n\n    if len(self.children) > 0:\n      results_for_total = []\n      for trace in self.children:\n        result = trace.ConsumeOutput(output, result_tracker)\n        if result is not None:\n          results_for_total.append(result)","sourceCodeStart":447,"sourceCodeEnd":483,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/v8/tools/run_perf.py#L447-L483","documentation":"LeafTraceConfig is, by design, a terminal node in the suite tree. Calling AppendChild on it is a programmer error: leaves cannot have children. The exception message names the offending class.","triggerScenarios":"Suite-tree construction code calling node.AppendChild(...) on a node that was instantiated as a LeafTraceConfig.","commonSituations":"A bug in suite-builder logic; a config type that should have been an interior GraphConfig/VariantConfig was wrongly instantiated as a leaf; refactor that broke node-type selection.","solutions":["Use a non-leaf GraphConfig subclass (e.g. VariantConfig) for any node that needs children.","Refactor the suite tree so children attach to an interior node, not to the leaf.","Treat this as a programmer error in the suite config classes — fix the caller, not the data."],"exampleFix":"// before\nleaf = LeafTraceConfig(suite, parent, arch)\nleaf.AppendChild(child)  // raises\n// after\ninterior = GraphConfig(suite, parent, arch)\ninterior.AppendChild(LeafTraceConfig(child_suite, interior, arch))","handlingStrategy":"type-guard","validationCode":"# Before appending, make sure the parent is not a leaf.\nfrom run_perf import LeafTraceConfig\nassert not isinstance(node, LeafTraceConfig), (\n    f'cannot append child to leaf node of type {type(node).__name__}')","typeGuard":"def can_have_children(node):\n    from run_perf import LeafTraceConfig\n    return not isinstance(node, LeafTraceConfig)","tryCatchPattern":null,"preventionTips":["Choose node types deliberately during suite construction; only interior nodes may have children.","Add a unit test asserting AppendChild raises on LeafTraceConfig.","When refactoring suite classes, keep the leaf-vs-interior invariant explicit."],"tags":["run-perf","suite-tree","v8","api-misuse"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}