Bone Heat Weighting: failed to find solution for one or more bones

I’m trying to parent an object to a rig with automatic weights. The weights don’t paint and Blender says: Bone Heat Weighting: failed to find solution for one or more bones