In Spanish, we can use the word ‘coco’ (coconut) as slang for the head, so comerse el coco really means to eat one’s own head by worrying, stressing or over-thinking about a situation!
No te comas el coco con eso. No es tan grave y tiene fácil solución.