Skip to content

[Bug]: GetFlatMesh/GetLine crashes with WASM memory errors on large Revit-exported IFC4 MEP models #1999

Description

@mc-perst

What happened?

Hi,

We are seeing recurring crashes in web-ifc when parsing large Revit-exported IFC4 MEP models.

The model can be opened and many entities can be read, but during geometry extraction web-ifc intermittently aborts or throws low-level WASM errors from calls such as GetFlatMesh, GetLine, and sometimes CloseModel after previous aborts.

Typical errors:

[GetMesh()] unexpected mesh type 78973
Aborted()
RuntimeError: memory access out of bounds
RuntimeError: table index is out of bounds

Example stack traces point to:

IfcAPI.GetFlatMesh(...)
IfcAPI.GetLine(...)
IfcAPI.CloseModel(...)

This mostly happens on large MEP files, around 400 MB+, with many repeated/complex objects such as:

IfcValve
IfcPump
IfcWasteTerminal
IfcSanitaryTerminal
IfcDuctSegment
IfcDuctFitting
IfcAirTerminal
IfcDamper
IfcFan

The issue does not appear to be that the whole IFC cannot be opened. Metadata parsing mostly works. The instability appears when extracting mesh/flat mesh data for certain representations in large files. After some aborts, later calls may also fail or CloseModel may throw memory access out of bounds.

We have added defensive handling in our app, but would like to understand whether this is a known limitation/bug in web-ifc, and whether there is a recommended way to isolate or skip unsupported geometry representations safely.

The IFC files are large and project-sensitive. What is the preferred way to share a reproducible file or subset privately with maintainers?

Version

0.0.77

What browsers are you seeing the problem on?

No response

Relevant log output

Object.<anonymous> (src/services/ifc-parser/parse-ifc-file.spec.ts:24:5)

  console.error
    Aborted()

      at abort (node_modules/web-ifc/web-ifc-api-node.js:4529:11)
      at __abort_js (node_modules/web-ifc/web-ifc-api-node.js:4685:32)
      at null.<anonymous> (wasm:/wasm/004eaa6e:1:847852)
      at null.<anonymous> (wasm:/wasm/004eaa6e:1:52572)
      at null.<anonymous> (wasm:/wasm/004eaa6e:1:79600)
      at null.<anonymous> (wasm:/wasm/004eaa6e:1:6753)
      at null.<anonymous> (wasm:/wasm/004eaa6e:1:176658)
      at null.<anonymous> (wasm:/wasm/004eaa6e:1:66425)
      at null.<anonymous> (wasm:/wasm/004eaa6e:1:62162)
      at null.<anonymous> (wasm:/wasm/004eaa6e:1:98751)
      at null.<anonymous> (wasm:/wasm/004eaa6e:1:418635)
      at null.<anonymous> (wasm:/wasm/004eaa6e:1:915434)
      at null.<anonymous> (wasm:/wasm/004eaa6e:1:878977)
      at dynCall (node_modules/web-ifc/web-ifc-api-node.js:5358:21)
      at node_modules/web-ifc/web-ifc-api-node.js:5364:74
      at Object.GetFlatMesh (node_modules/web-ifc/web-ifc-api-node.js:5509:22)
      at IfcAPI2.GetFlatMesh (node_modules/web-ifc/web-ifc-api-node.js:73135:28)
      at GetFlatMesh (src/services/ifc-parser/itemgeometry/extractItemGeometry.ts:66:32)
      at prepareGeometryInput (src/services/ifc-parser/itemgeometry/extractItemGeometry.ts:50:20)
      at src/services/ifc-parser/itemgeometry/extractItemGeometryAuto.ts:133:26
      at fn (src/services/ifc-parser/itemgeometry/extractItemGeometryAuto.ts:52:12)
      at withSuppressedWebIfcMeshWarnings (src/services/ifc-parser/itemgeometry/extractItemGeometryAuto.ts:132:22)
      at parseIfcFile (src/services/ifc-parser/parse-ifc-file.ts:344:54)
      at parseFileInTest (src/services/ifc-parser/parse-ifc-file.spec.ts:91:18)
      at Object.<anonymous> (src/services/ifc-parser/parse-ifc-file.spec.ts:24:5)

  console.log
    [2026-05-19 00:34:42.024] [error] [GetMesh()] unexpected mesh type 78973

      at Object.put_char (node_modules/web-ifc/web-ifc-api-node.js:6592:13)

  console.log
    [2026-05-19 00:34:47.808] [error] [GetMesh()] unexpected mesh type 78949

      at Object.put_char (node_modules/web-ifc/web-ifc-api-node.js:6592:13)

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions