René's URL Explorer Experiment


Title: Refresh Linked Aggregate crashes on a nested assembly that isn't a linked aggregate · Issue #9582 · IfcOpenShell/IfcOpenShell · GitHub

Open Graph Title: Refresh Linked Aggregate crashes on a nested assembly that isn't a linked aggregate · Issue #9582 · IfcOpenShell/IfcOpenShell

X Title: Refresh Linked Aggregate crashes on a nested assembly that isn't a linked aggregate · Issue #9582 · IfcOpenShell/IfcOpenShell

Description: Bug Description bim.refresh_linked_aggregate crashes with StopIteration when a linked aggregate contains a nested IfcElementAssembly that is not itself a linked aggregate. To reproduce: Have several linked aggregates in the model. Select...

Open Graph Description: Bug Description bim.refresh_linked_aggregate crashes with StopIteration when a linked aggregate contains a nested IfcElementAssembly that is not itself a linked aggregate. To reproduce: Have severa...

X Description: Bug Description bim.refresh_linked_aggregate crashes with StopIteration when a linked aggregate contains a nested IfcElementAssembly that is not itself a linked aggregate. To reproduce: Have severa...

Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/issues/9582

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Refresh Linked Aggregate crashes on a nested assembly that isn't a linked aggregate","articleBody":"### Bug Description\n\n`bim.refresh_linked_aggregate` crashes with `StopIteration` when a linked aggregate contains a nested `IfcElementAssembly` that is not itself a linked aggregate.\n\n**To reproduce:**\n\n1. Have several linked aggregates in the model.\n2. Select them all (the assembly empties *and* their parts).\n3. `Add Aggregate` (`bim.add_aggregate`) to wrap the whole selection in a new aggregate.\n4. Duplicate that new aggregate (which promotes it to a linked aggregate).\n5. Run `Refresh Linked Aggregate` on it → `StopIteration`.\n\n**Root cause**\n\n`get_original_data` in `src/bonsai/bonsai/bim/module/geometry/operator.py` starts with a bare `next()` with no default:\n\n```python\ndef get_original_data(element):\n    group: int = next(\n        r.RelatingGroup\n        for r in getattr(element, \"HasAssignments\", []) or []\n        if r.is_a(\"IfcRelAssignsToGroup\")\n        if self.group_name in r.RelatingGroup.Name\n    ).id()\n```\n\nAt the top level this is safe — `handle_selection` does the same lookup inside a `try/except` and bails with *\"Object is not part of a Linked Aggregate\"*. But the **recursive** call is unguarded:\n\n```python\nparts = ifcopenshell.util.element.get_parts(element)\nif parts:\n    for part in parts:\n        if part.is_a(\"IfcElementAssembly\"):\n            nested_data = get_original_data(part)   # \u003c-- no guard\n```\n\nSo the operator assumes *every nested `IfcElementAssembly` inside a linked aggregate is itself a linked aggregate*. Any nested assembly without a `BBIM_Linked_Aggregate` group assignment raises `StopIteration` instead of being skipped.\n\n**Why the repro produces that shape**\n\n`BIM_OT_add_aggregate._execute` creates a bare `IfcElementAssembly` and re-parents the selection under it. It never assigns a `BBIM_Linked_Aggregate` group or pset, so wrapping linked aggregates this way is a first-class way to create nested assemblies that violate the assumption above.\n\n**Related weak spots in the same function**\n\n- `select_objects_and_add_data` only calls `add_linked_aggregate_pset(element, ...)` when the element **has parts**, so an empty nested assembly gets a group but no pset, and later dies on `pset[\"Index\"]` — the same failure as #4435.\n- `delete_objects` also recurses into nested assemblies unconditionally and deletes them, so refresh over a nested structure is risky beyond this crash.\n\n**Note on PR #8319**\n\n#8319 (for #8233) makes plain duplicates re-join the same `BBIM_Linked_Aggregate` group. That grows `get_group_elements`, so more elements land in `instances_to_refresh` and get recursed into — it likely makes this crash easier to hit. Worth reviewing the two together.\n\nVerified present on `v0.9.0` as well (the `next()` is unchanged there).\n\n### Attachments\n\nNone. The crash happened with unsaved changes, so the saved IFC predates the\nfailing state; the traceback and the structure that triggers it are below.\n\n### Debug and Error Output\n\n```true\nos: Windows\nos_version: 10.0.19045\npython_version: 3.13.13\narchitecture: ('64bit', 'WindowsPE')\nmachine: AMD64\nprocessor: Intel64 Family 6 Model 158 Stepping 10, GenuineIntel\nblender_version: 5.2.1 LTS\nbonsai_version: 0.0.0\nbonsai_commit_hash: 8ffab9d\nbonsai_commit_date: 2026-09-23T09:44:15-05:00\nbonsai_git_branch: Ryan_build-0.8.6-alpha2607071335\nlast_actions: \n# ifcopenshell.api: owner.update_owner_history\n>>> {\"element\": {\"cast_type\": \"entity_instance\", \"value\": 4120503, \"Name\": \"Beam.035\"}}\n# ifcopenshell.api: pset.add_pset\n>>> {\"product\": {\"cast_type\": \"entity_instance\", \"value\": 4120445, \"Name\": \"Beam.033\"}, \"name\": \"BBIM_Linked_Aggregate\"}\n# ifcopenshell.api: owner.create_owner_history\n>>> {}\n# ifcopenshell.api: pset.assign_pset\n>>> {}\n# ifcopenshell.api: owner.create_owner_history\n>>> {}\n# ifcopenshell.api: pset.edit_pset\n>>> {\"pset\": {\"cast_type\": \"entity_instance\", \"value\": 4120689, \"Name\": \"BBIM_Linked_Aggregate\"}, \"properties\": \"{'Index': 2}\"}\n# ifcopenshell.api: pset.add_pset\n>>> {\"product\": {\"cast_type\": \"entity_instance\", \"value\": 4120503, \"Name\": \"Beam.035\"}, \"name\": \"BBIM_Linked_Aggregate\"}\n# ifcopenshell.api: owner.create_owner_history\n>>> {}\n# ifcopenshell.api: pset.assign_pset\n>>> {}\n# ifcopenshell.api: owner.create_owner_history\n>>> {}\n# ifcopenshell.api: pset.edit_pset\n>>> {\"pset\": {\"cast_type\": \"entity_instance\", \"value\": 4120694, \"Name\": \"BBIM_Linked_Aggregate\"}, \"properties\": \"{'Index': 1}\"}\n# ifcopenshell.api: group.assign_group\n>>> {\"group\": {\"cast_type\": \"entity_instance\", \"value\": 4103768, \"Name\": \"BBIM_Linked_Aggregate\"}, \"products\": [{\"cast_type\": \"entity_instance\", \"value\": 4120597, \"Name\": \"Default_Name_1\"}]}\n# ifcopenshell.api: owner.update_owner_history\n>>> {\"element\": {\"cast_type\": \"entity_instance\", \"value\": 4103770, \"Name\": null}}\n# ifcopenshell.api: pset.add_pset\n>>> {\"product\": {\"cast_type\": \"entity_instance\", \"value\": 4120597, \"Name\": \"Default_Name_1\"}, \"name\": \"BBIM_Linked_Aggregate\"}\n# ifcopenshell.api: owner.create_owner_history\n>>> {}\n# ifcopenshell.api: pset.assign_pset\n>>> {}\n# ifcopenshell.api: owner.create_owner_history\n>>> {}\n# ifcopenshell.api: pset.edit_pset\n>>> {\"pset\": {\"cast_type\": \"entity_instance\", \"value\": 4120699, \"Name\": \"BBIM_Linked_Aggregate\"}, \"properties\": \"{'Index': 0, 'Name': 'Default_Name', 'Aggregate_Index': 3}\"}\n# operator: BIM_OT_override_move_select\n# operator: BIM_OT_refresh_linked_aggregate\nlast_error: Traceback (most recent call last):\n  File \"C:\\Users\\Ryan Schultz\\AppData\\Roaming\\Blender Foundation\\Blender\\5.2\\extensions\\.local\\lib\\python3.13\\site-packages\\bonsai\\bim\\ifc.py\", line 569, in execute_ifc_operator\n    result = getattr(operator, \"_execute\")(context)\n  File \"C:\\Users\\Ryan Schultz\\AppData\\Roaming\\Blender Foundation\\Blender\\5.2\\extensions\\.local\\lib\\python3.13\\site-packages\\bonsai\\bim\\module\\geometry\\operator.py\", line 2062, in _execute\n    element_original_data = get_original_data(element)\n  File \"C:\\Users\\Ryan Schultz\\AppData\\Roaming\\Blender Foundation\\Blender\\5.2\\extensions\\.local\\lib\\python3.13\\site-packages\\bonsai\\bim\\module\\geometry\\operator.py\", line 1848, in get_original_data\n    nested_data = get_original_data(part)\n  File \"C:\\Users\\Ryan Schultz\\AppData\\Roaming\\Blender Foundation\\Blender\\5.2\\extensions\\.local\\lib\\python3.13\\site-packages\\bonsai\\bim\\module\\geometry\\operator.py\", line 1821, in get_original_data\n    group: int = next(\n                 ~~~~^\n        r.RelatingGroup\n        ^^^^^^^^^^^^^^^\n    ...\u003c2 lines>...\n        if self.group_name in r.RelatingGroup.Name\n        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n    ).id()\n    ^\nStopIteration\n\nblend_file_path: D:\\Dropbox\\Gitea_OD\\Entry_Portico\\Open\\Models\\Bonsai\\Entry_Portico.blend\nblend_file_dirty: True\nifc_file_path: Entry_Portico.ifc\nifc_is_dirty: True\nifc: Entry_Portico.ifc\nschema: IFC4\npreprocessor_version: IfcOpenShell 0.0.0\noriginating_system: Bonsai 0.8.6-alpha260923-8ffab9d\n```\n\n","author":{"url":"https://github.com/theoryshaw","@type":"Person","name":"theoryshaw"},"datePublished":"2026-09-24T02:14:49Z","url":"https://github.com/IfcOpenShell/IfcOpenShell/issues/9582"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:b61f529d-24e3-1ab0-d8ef-4ea4d7781d69
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB9AC:A2A16:874A:B68C:6B046A68
html-safe-noncef21e8098b7d234a175927ec87b64eea1dbd289b62462b7e654d7e3f00dbda8de
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOUFDOkEyQTE2Ojg3NEE6QjY4Qzo2QjA0NkE2OCIsInZpc2l0b3JfaWQiOiI4ODEzMzI4MzU3Mzc0MzA2MzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac2db9d7aa88105a1a2175ada265ab11178b2fc4bb7c0c7f63d621d959cd25e13a
hovercard-subject-tagissue:5562033539
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/IfcOpenShell/IfcOpenShell/9582/issue_layout
twitter:imagehttps://opengraph.githubassets.com/d2b104928b7482b7df1010dea25e685446de32b8b7f047ab822e22dc1c8cf03e/IfcOpenShell/IfcOpenShell/issues/9582
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/d2b104928b7482b7df1010dea25e685446de32b8b7f047ab822e22dc1c8cf03e/IfcOpenShell/IfcOpenShell/issues/9582
og:image:altBug Description bim.refresh_linked_aggregate crashes with StopIteration when a linked aggregate contains a nested IfcElementAssembly that is not itself a linked aggregate. To reproduce: Have severa...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernametheoryshaw
hostnamegithub.com
expected-hostnamegithub.com
None83e4c0e58c5162177f3c161c5fbad38527ae04c11ac14980f9f9d85ae2027b1f
turbo-cache-controlno-preview
go-importgithub.com/IfcOpenShell/IfcOpenShell git https://github.com/IfcOpenShell/IfcOpenShell.git
octolytics-dimension-user_id13692563
octolytics-dimension-user_loginIfcOpenShell
octolytics-dimension-repository_id40473201
octolytics-dimension-repository_nwoIfcOpenShell/IfcOpenShell
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id40473201
octolytics-dimension-repository_network_root_nwoIfcOpenShell/IfcOpenShell
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseca4d07a7cef4e4b75f821dc25e7300d80c1450a9
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/IfcOpenShell/IfcOpenShell/issues/9582#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FIfcOpenShell%2FIfcOpenShell%2Fissues%2F9582
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FIfcOpenShell%2FIfcOpenShell%2Fissues%2F9582
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=IfcOpenShell%2FIfcOpenShell
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/issues/9582
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/issues/9582
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/issues/9582
IfcOpenShellhttps://github.com/IfcOpenShell
IfcOpenShellhttps://github.com/IfcOpenShell/IfcOpenShell
Codehttps://github.com/IfcOpenShell/IfcOpenShell
Issues1.2k (1.2k)https://github.com/IfcOpenShell/IfcOpenShell/issues
Pull requests936 (936)https://github.com/IfcOpenShell/IfcOpenShell/pulls
Discussionshttps://github.com/IfcOpenShell/IfcOpenShell/discussions
Actionshttps://github.com/IfcOpenShell/IfcOpenShell/actions
Projectshttps://github.com/IfcOpenShell/IfcOpenShell/projects
Wikihttps://github.com/IfcOpenShell/IfcOpenShell/wiki
Security and qualityhttps://github.com/IfcOpenShell/IfcOpenShell/security
Insightshttps://github.com/IfcOpenShell/IfcOpenShell/insights
https://github.com/IfcOpenShell/IfcOpenShell
New issuehttps://github.com/login?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/9582
New issuehttps://github.com/login?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/9582
#9589https://github.com/IfcOpenShell/IfcOpenShell/pull/9589
Refresh Linked Aggregate crashes on a nested assembly that isn't a linked aggregatehttps://github.com/IfcOpenShell/IfcOpenShell/issues/9582#top
#9589https://github.com/IfcOpenShell/IfcOpenShell/pull/9589
Bonsaihttps://github.com/IfcOpenShell/IfcOpenShell/issues?q=state%3Aopen%20label%3A%22Bonsai%22
PR ProposedA PR has been proposed for this bug/feature.https://github.com/IfcOpenShell/IfcOpenShell/issues?q=state%3Aopen%20label%3A%22PR%20Proposed%22
https://github.com/theoryshaw
theoryshawhttps://github.com/theoryshaw
on Sep 24, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/9582#issue-5562033539
Error when refreshing linked aggregate #4435https://github.com/IfcOpenShell/IfcOpenShell/issues/4435
#8319https://github.com/IfcOpenShell/IfcOpenShell/pull/8319
#8319https://github.com/IfcOpenShell/IfcOpenShell/pull/8319
#8233https://github.com/IfcOpenShell/IfcOpenShell/issues/8233
theoryshawhttps://github.com/theoryshaw
Bonsaihttps://github.com/IfcOpenShell/IfcOpenShell/issues?q=state%3Aopen%20label%3A%22Bonsai%22
on Sep 24, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/9582#event-31723291851
https://github.com/theoryshaw
theoryshawhttps://github.com/theoryshaw
on Sep 24, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/9582#issuecomment-5818310715
#9588https://github.com/IfcOpenShell/IfcOpenShell/issues/9588
#9588https://github.com/IfcOpenShell/IfcOpenShell/issues/9588
theoryshawhttps://github.com/theoryshaw
PR ProposedA PR has been proposed for this bug/feature.https://github.com/IfcOpenShell/IfcOpenShell/issues?q=state%3Aopen%20label%3A%22PR%20Proposed%22
on Sep 24, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/9582#event-31776319585
Sign up for freehttps://github.com/signup?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/9582
Sign in to commenthttps://github.com/login?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/9582
Bonsaihttps://github.com/IfcOpenShell/IfcOpenShell/issues?q=state%3Aopen%20label%3A%22Bonsai%22
PR ProposedA PR has been proposed for this bug/feature.https://github.com/IfcOpenShell/IfcOpenShell/issues?q=state%3Aopen%20label%3A%22PR%20Proposed%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.