Door ice dispenser working intermittently

When trying to get ice out through door dispenser it only works intermittently. Can switch from cube to crushed which some times gets it to work. If switched to water it always works so don’t believe it’s the switch. What could be the problem? (motor or capacitor?)