Not everybody knows this or has had the opportunity to feel it themselves. But being told "I told you so!", hurts. Actually it feels like being kicked while you already know you made a mistake. It's salt on a wound! We should never hurt anyone intentionally.
It's important to have a constructive intent. When you work in a team setting, it's important to have a team goal in mind. Nothing is as destructive as someone trying to have solo-wins and and ignores their own role in a team-failure.
So if you have the feeling someone is making a mistake, either keep your mouth, or start a constructive conversation. But also be honest to yourself, if it's just a feeling and you don't know any better solution, why should you share this? Of course you can cooperate with your team mate, start like this: "Hmm, I see your proposed solution. Do you think we can improve on this solution a bit? I have a feeling we can do better, but not sure how yet. I'm sure together we can find an improved solution in just half an hour at the whiteboard."
If your plan is just to let bad words out like "That's not going to work", just don't do it. If you don't take care, it could be you will be seen as a toxic team member caused by your poisonous behavior.
I haven't failed. I've just found 10,000 ways that won't work
By quoting Thomas Edison, I don't want you to find 10,000 ways that won't work. Most of the time your solution will evolve. You will learn by doing. Improving a bit every day, let's keep that in mind. Sometimes a solution doesn't feel right, yet. But keep the solution open to improvements. In that way you won't fail, but make your solution better, byte by byte.
Everyone should be allowed to have happy accidents. Even if someone fails, be honest, we all failed at least 42 times. So if someone feels bad about the failure, tell him one of your failure anecdotes.