Page MenuHome

Blender crashes when invalid edges are defined and switching to edit mode
Closed, ArchivedPublic


System Information
Operating system: Linux Mint
Graphics card: GeForce RTX 2060 Super

Blender Version
Broken: 2.92.0
Worked: unknown

Short description of error

Blender crashes when an object with invalid edges is created and then switching to edit mode.

  • Expected behavior ***

It should not be possible to add a edges with invalid indices. Does checking this create a performance loss that is too big? At least the edit mode should not crash when such edges are Trying to be accessed. After all the object mode also seems to be handling this fine.

Exact steps for others to reproduce the error

# Start Blender (2.92.0) and run this script

import bpy
from math import cos, sin

# Clean up

# Create mesh
vertices = [[0,0,0],[1,1,0],[2,2,0]]
# There is one additional edge in here!
edges = [[0,1],[1,2],[2,3]]
faces = []

mesh ='object')
obj =, mesh)
mesh.from_pydata(vertices, edges, faces)
obj.select_set(state=True) = obj

# Now press TAB to go to edit mode and make Blender crash
# (sometimes need to wait a bit or press several times)

Event Timeline

Philipp Oeser (lichtwerk) closed this task as Archived.Wed, May 5, 1:37 PM


Invalid mesh data (out of range indices, edges with matching indices, 2 sided faces… etc) are not prevented. If the data used for mesh creation isn’t known to be valid, run Mesh.validate after this function.

so insterting



mesh.from_pydata(vertices, edges, faces)

will check (and clean up) the mesh, thus preventing the crash.

This is not considered a bug, it is documented behavior.
Thx reporting, but will have to close.