Quitting on the first try

Have you ever encountered an error message that says, "an error occurred, please try again" or something along those lines? How many times has it worked after you tried it again?

Should websites automatically try redoing the action a few times before displaying an error message?

For example, if a form couldn't be submitted, should it try a couple of times before telling the user that there's a problem? Sometimes, the error happened "just by chance" and it won't occur on subsequent attempts. If the website automatically tries again, it can save the user from a bad error message experience.