Sometimes the water the little guy is in is too hard, and makes the shell too hard to get out of/ complete the molt. The cray would need plenty of minerals in the food it eats / an appropriate diet for a cray, to eat because that is needed to make the shell.
It could have been when the little guy was at the location before you got him, and as AD mentioned it can also just happen when they are little babies.
What kind of Cray was it?
Do you know what your water parameters are?
Referring back to AquaticArts dot com - For Procambarus Clarkii and Alleni refer to 6.5-7.5 pH and KH
Similar for Cherax.
Those numbers could be slightly different if bred and raised in local conditions which were somewhat different.
Very sorry to hear it didn't make it. Over the years I have really loved the couple of regular Crayfish I have had, and continue to adore the Dwarf Crays. Just do not have room for the bigger ones at the moment. My last was a Ghost and was really fun to feed and would come over to the top DW to greet me (or to get food, lol). Very fun. I hope you are successful with a new one.
What are/were you feeding?