The story from the Gospel of Thomas come at a moment when Jesus is still a young boy, so he is not committing sin against sabbath law. Joseph reproves him gently as a way of instructing him in the importance of sabbath. And, as I pointed out, Joseph imposes no punishment.
Blinding people and cursing them as alleged to have happened does not fall into the *spilling milk by accident* category.
From this article......
https://www.gotquestions.org/Infancy-Gospel-of-Thomas.html
• Bringing dried fish to life (in some later versions)
• Bringing life to clay sparrows that Jesus had crafted on the Sabbath
• Cursing a boy who dies
• Cursing a boy who dies and his parents, who are blinded
• Raising a friend who was killed by falling from a roof (knowing the character of the Jesus presented in this “Gospel,” the parents accuse Jesus of throwing him off the roof)
• Healing a man who cut off part of his foot while chopping wood
• Carrying water in a cloak after accidentally breaking the water jar
• Sowing one grain and receiving one hundred measures in harvest
• Stretching a piece of wood to help Joseph, the carpenter, make a bed for a rich client
• Healing James from snake bite
• Resurrecting a child who died of illness
• Resurrecting a man who died in an accident
From the article as well:
“In some places, the Infancy Gospel of Thomas portrays Jesus as a violent, petulant child. In one incident, after Jesus blinds the parents of a boy He struck dead, Joseph reprimands Him: “When Joseph saw that Jesus had done such a thing, he got angry and grabbed his ear and pulled very hard. The boy became infuriated with him and replied, ‘It’s one thing for you to seek and not find; it’s quite another for you to act this unwisely. Don’t you know that I don’t really belong to you? Don’t make me upset.” This is not supposed to be Jesus as a teenager or young adult, but as a child of single-digit age.
The portrait of Jesus painted in the Infancy Gospel of Thomas is that of an insolent bully who uses His power frivolously. People are impressed with His sheer power and cleverness, but not with His kindness, as they are afraid of Him. After one display of Jesus’ abilities, “no one dared to anger him for fear of being cursed and maimed for life.” The Infancy Gospel of Thomas does not present Jesus as one who honors His parents or who grows in favor with His neighbors and therefore is at odds with what we know of Jesus the man.”
***************************************************************
So if you want to believe it and excuse or rationalize it way, that’s your business, but it’s so inconsistent with the character of Jesus, that it takes some real mental gymnastics. And some of those incidents do NOT fall at all within the childishness and immaturity category. Spiteful and vindictive, yes. But to try to justify them as something Jesus did as a boy is absurd, even considering the age of accountability.
—> The story from the Gospel of Thomas come at a moment when Jesus is still a young boy,
Came in the second century and is not scripture.