{"record":{"id":"1407536622ba0955","repo":"rust-lang/rust","slug":"cannot-bless-invalid-child","errorCode":null,"errorMessage":"Cannot bless invalid child","messagePattern":"Cannot bless invalid child","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/etc/lldb_batchmode/from_lldb.py","lineNumber":241,"sourceCode":"def type_from_lldb(ty: lldb.SBType, sbtarget: lldb.SBTarget) -> Type:\n    if BLESS and not ty.IsValid():\n        raise Exception(\"Cannot bless invalid SBType object\")\n\n    generic_types = get_generics(ty, sbtarget)\n    generics = [g.GetName() for g in generic_types]\n\n    return Type(\n        ty.GetByteSize(),\n        ty.GetBasicType(),\n        ty.GetTypeClass(),\n        [field_from_lldb(ty.GetFieldAtIndex(i)) for i in range(ty.GetNumberOfFields())],\n        generics,\n    )\n\n\ndef child_from_lldb(child: lldb.SBValue) -> Child:\n    if BLESS and not child.IsValid():\n        raise Exception(\"Cannot bless invalid child\")\n\n    sbtype: lldb.SBType = child.GetType()\n\n    if not sbtype.IsPointerType() and sbtype.GetBasicType() != lldb.eBasicTypeInvalid:\n        value = decode_primitive(child)\n    else:\n        value = None\n\n    children = [\n        child_from_lldb(child.GetChildAtIndex(i)) for i in range(child.GetNumChildren())\n    ]\n\n    return Child(child.GetName(), child.GetType().GetName(), value, children)\n\n\ndef variable_from_lldb(var: lldb.SBValue) -> Variable:\n    if BLESS and not var.IsValid():\n        raise Exception(\"Cannot bless invalid SBValue object\")","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/src/etc/lldb_batchmode/from_lldb.py#L223-L259","documentation":"Raised by from_lldb.child_from_lldb during a bless run when an lldb.SBValue child fails IsValid(). Children are recursively read to build the golden value tree; an invalid child would poison the reference data, so blessing stops.","triggerScenarios":"Calling child_from_lldb with BLESS=True on a child from SBValue.GetChildAtIndex(i) that LLDB could not materialize (e.g. a synthesized child that the pretty-printer failed to produce, or a member elided by optimization).","commonSituations":"A rustc LLDB synthetic provider returns a child count but one of the children is invalid; debug info is incomplete for a nested type; an LLDB upgrade changes the synthetic provider's child layout.","solutions":["Check the synthetic provider for the type and confirm every indexed child is valid.","Recompile the test crate with -C debuginfo=2 and lower optimization.","Re-bless after fixing the provider so the golden file reflects the corrected child set."],"exampleFix":"# before: recursing blindly\n[child_from_lldb(v.GetChildAtIndex(i)) for i in range(v.GetNumChildren())]\n# after: skip invalid children during recursion\n[child_from_lldb(c) for i in range(v.GetNumChildren()) if (c := v.GetChildAtIndex(i)).IsValid()]\n","handlingStrategy":"type-guard","validationCode":"children = []\nfor i in range(v.GetNumChildren()):\n    c = v.GetChildAtIndex(i)\n    if BLESS and not c.IsValid():\n        raise Exception(f\"Cannot bless invalid child at index {i} of {v.GetName()}\")\n    children.append(child_from_lldb(c))\n","typeGuard":"def is_valid_child(child: lldb.SBValue) -> bool:\n    return child.IsValid()\n","tryCatchPattern":null,"preventionTips":["Confirm synthetic providers return valid children for every index before blessing.","Recompile with full debug info so nested fields resolve."],"tags":["lldb","debuginfo","blessing","rust"],"backgroundTag":null,"analyzedSha":"7088e4b63a9516ebfbfe2ab2d999cf01a528ac14","analyzedAt":"2026-08-10T14:17:03.603Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}