René's URL Explorer Experiment


Title: project.append_asset: AssertionError in SafeRemovalContext.__exit__ when removing an untracked element · Issue #8666 · IfcOpenShell/IfcOpenShell · GitHub

Open Graph Title: project.append_asset: AssertionError in SafeRemovalContext.__exit__ when removing an untracked element · Issue #8666 · IfcOpenShell/IfcOpenShell

X Title: project.append_asset: AssertionError in SafeRemovalContext.__exit__ when removing an untracked element · Issue #8666 · IfcOpenShell/IfcOpenShell

Description: Describe the bug ifcopenshell.api.project.append_asset can abort with an uncaught AssertionError inside SafeRemovalContext.__exit__ while appending a product asset (with the default assume_asset_uniqueness_by_name=True): File ".../ifcope...

Open Graph Description: Describe the bug ifcopenshell.api.project.append_asset can abort with an uncaught AssertionError inside SafeRemovalContext.__exit__ while appending a product asset (with the default assume_asset_un...

X Description: Describe the bug ifcopenshell.api.project.append_asset can abort with an uncaught AssertionError inside SafeRemovalContext.__exit__ while appending a product asset (with the default assume_asset_un...

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

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":"project.append_asset: AssertionError in SafeRemovalContext.__exit__ when removing an untracked element","articleBody":"### Describe the bug\n\n`ifcopenshell.api.project.append_asset` can abort with an uncaught `AssertionError` inside `SafeRemovalContext.__exit__` while appending a product asset (with the default `assume_asset_uniqueness_by_name=True`):\n\n```\n  File \".../ifcopenshell/api/project/append_asset.py\", line 420, in append_product\n    with SafeRemovalContext(self.file, self.reuse_identities, self.assume_asset_uniqueness_by_name):\n  File \".../ifcopenshell/api/project/append_asset.py\", line 188, in __exit__\n    assert len(removed_identities) == len(removed_elements)\nAssertionError\n```\n\nThe `SafeRemovalContext` wraps the `edit_object_placement` call in `append_product`. It batches `remove_deep2` deletions into `file.to_delete`, and on exit asserts that **every** removed element is tracked in `reuse_identities`:\n\n```python\nremoved_elements = self.file.to_delete\nfor identity, element in self.reuse_identities.items():\n    if element in removed_elements:\n        removed_identities[element] = identity\nassert len(removed_identities) == len(removed_elements)\n```\n\n### Analysis\n\n`remove_deep2` only ever purges an element when *all* of its inverses lie inside the subgraph being deleted. Therefore a removed element that is **not** tracked in `reuse_identities` cannot be referenced by any surviving `reuse_identities` value, and needs no cleanup. The equality `assert` nevertheless turns this benign case into a hard crash and aborts the whole append.\n\nThe cleanup that actually matters — purging `reuse_identities` entries whose value was removed, so the map never later returns a freed entity — already works correctly for the tracked subset, independent of whether untracked removals also occurred.\n\n### Suggested fix\n\nDrop the equality assertion. Continue collecting and cleaning up the tracked identities, and simply ignore untracked removed elements (they are provably safe to remove). i.e. remove the `assert len(removed_identities) == len(removed_elements)` line; the rest of `__exit__` is unchanged.\n\n### Reproduction\n\nEncountered when appending a product (an `IfcFurniture`/equipment asset with geometry) from a library into an **existing populated** project. A self-contained minimal reproduction is still being narrowed down — the trigger is an asset whose object-placement subgraph, during `edit_object_placement`'s `remove_deep2`, purges an element that was not registered in `reuse_identities`. Guidance on which asset shape reliably produces an untracked placement removal would be welcome.\n\n### Environment\n\n- ifcopenshell (bundled with Bonsai on Blender 4.5), schema IFC4, `v0.8.0` branch.\n","author":{"url":"https://github.com/theoryshaw","@type":"Person","name":"theoryshaw"},"datePublished":"2026-07-17T02:39:43Z","url":"https://github.com/IfcOpenShell/IfcOpenShell/issues/8666"}

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:a1ecea77-e2b6-0b7a-646f-3470c5e917b4
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA264:29F525:1DA943:27D0F4:6B04833B
html-safe-nonce45df13af70307b2470561e33b92dd165642b5d7f8016f7b1a236ccf194111945
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMjY0OjI5RjUyNToxREE5NDM6MjdEMEY0OjZCMDQ4MzNCIiwidmlzaXRvcl9pZCI6Ijg1ODY0MDA4MTA2Njg0MjYwNDMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac2bab13b0e8f144becdbe5079c72c82437cd527486c71ac32f6f53cc91b2451d8
hovercard-subject-tagissue:4907574166
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/8666/issue_layout
twitter:imagehttps://opengraph.githubassets.com/6dc3ad2811f73e22e4ea018a6f1cbd34de2f1ce9ff90ae5364b148b6b3853395/IfcOpenShell/IfcOpenShell/issues/8666
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/6dc3ad2811f73e22e4ea018a6f1cbd34de2f1ce9ff90ae5364b148b6b3853395/IfcOpenShell/IfcOpenShell/issues/8666
og:image:altDescribe the bug ifcopenshell.api.project.append_asset can abort with an uncaught AssertionError inside SafeRemovalContext.__exit__ while appending a product asset (with the default assume_asset_un...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernametheoryshaw
hostnamegithub.com
expected-hostnamegithub.com
None1d5c152376e38b7d2e37f3d5179be29a73bee93b85110da28a4eebe1159cdc70
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
releasef5017e8ff4ea25a8011fcf0f2a0e430c60dc86c8
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/IfcOpenShell/IfcOpenShell/issues/8666#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FIfcOpenShell%2FIfcOpenShell%2Fissues%2F8666
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%2F8666
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/8666
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/issues/8666
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/issues/8666
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 requests937 (937)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/8666
New issuehttps://github.com/login?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/8666
#8668https://github.com/IfcOpenShell/IfcOpenShell/pull/8668
project.append_asset: AssertionError in SafeRemovalContext.__exit__ when removing an untracked elementhttps://github.com/IfcOpenShell/IfcOpenShell/issues/8666#top
#8668https://github.com/IfcOpenShell/IfcOpenShell/pull/8668
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 Jul 17, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/8666#issue-4907574166
theoryshawhttps://github.com/theoryshaw
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
on Jul 17, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/8666#event-28100747984
theoryshawhttps://github.com/theoryshaw
on Oct 2, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/8666#event-32361118664
project.append_asset: don't crash on untracked removed element (IfcOp…https://github.com/theoryshaw/IfcOpenShell/commit/f5da3efe6d6ee1a6239f25d8c8acac98852281dc
IfcOp…https://github.com/IfcOpenShell/IfcOpenShell/issues/8666
f5da3efhttps://github.com/theoryshaw/IfcOpenShell/commit/f5da3efe6d6ee1a6239f25d8c8acac98852281dc
Sign up for freehttps://github.com/signup?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/8666
Sign in to commenthttps://github.com/login?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/8666
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.