I want to say
I almost made the mistake.
Is it correct to say
Ich habe den Fehler fast gemacht.
? I'm not sure about the adverb "fast" here, since it is modifying the verb "gemacht" (as opposed to an adjective.)
Fast is fine. Because the mistake wasn't really made, you would use subjunctive II:
A synonymous alternative to fast is using beinahe here:
Note that if you use the definitve article here, we do expect a further precision of the nature of the mistake in a following subordinate clause. In case the sentence stands alone it is better to use an indefinite article: