Are there cases where error and mistake are not interchangeable?
In statistics, an error is the amount that a measurement deviates from the 'true' value. Even if no mistakes are made in measuring (that is, all the right methods are used, and used correctly), there might still be error due to limited accuracy of the measurement tools, random fluctuations in the system under consideration, etc. The words are clearly not interchangeable in this context.
One case where they are not interchangeable is in computing where we write error message but not mistake message.
Generally speaking however, error is more formal than mistake. In technical contexts, a mistake happens because of human action, judgement, opinion or decision, while error has no such connotation and can be interpreted more broadly.
Even outside of computing, mistake generally aligns the error as the fault of the person who caused it, while error means it wouldn't have mattered who was involved — it was likely to happen regardless.
In the context of computer programming, mistakes are made by human beings making decisions, but errors can be caused by all kinds of faults, not just decision-making faults. For example, a file can be full of formatting errors, but those errors wouldn't constitute mistakes in the computer context unless a person had typed in the file by hand.
They are not interchangeable in idioms such as in error, trial and error, or error of one's ways.
I must say (though Jasper Loy beat me to it) that computer terminology seems to be more intolerant of replacing error with mistake. A fatal mistake, for instance, is not the same thing as the programming term fatal error.
Also from a baseball context, an error is when someone gets on base due to a defensive miscue. The play is always called an error on a scorecard.
Mistake is a subset of error. In simple terms, a mistake is always an error, but an error is not necessarily a mistake.
Examples might include:
John made a mistake when adding up his finances, but his wife noticed in time to rectify the error before he sent them off.
Mistake and error are interchangeable here.
Due to a lightning storm, the local internet exchange went down. The first I knew about it was when my browser displayed an error connecting to stackexchange.com.
This could only be error.
Shirley was completing her analysis of the new wing design. Her prototype machine, employing the latest cutting-edge technology, had a much lower margin of error than its predecessor.
Again, this could only be error.
Most of them, I would have thought.
I was taught that an error is when you've analysed the situation, arrived at a response - and it was wrong. (Stroking a lion won't make it calm down)
A mistake is something you unintentionally do. (E.g. forgetting to load the gun before shooting the lion)
Or, less dramatically: an error is the miscalculation due to using sin(x) instead of cos(x), whereas a mistake is forgetting to put in the decimal point in the answer.
One is in the expression error of your ways.
In my opinion;
An error is a problem with execution (you did it wrong)
Where as a mistake is a problem in leadership (you shouldn't have done it in the first place)
In most sense possible, "error" is more on a technical perspective, that is deviating unacceptably from the expected result. On the other hand, "mistake" is more on the non-technical side such as matters that concern morality, ethics or being not in the list of possible answers.