bone heat weighting failed blender code example
Example: Bone Heat Weighting: failed to find solution for one or more bones
When the object has duplicate vertices. This can be solved by removing doubles in Edit Mode ( keyboard shortcut "W" -> Remove Doubles)