Ah yes, the literal () are the real reason for this error.
Note1: if your literal () are balanced inside identifiers, there's no error: $replace((),(),a) returns 'a' correctly.
Note2: By parsing literal () inside identifiers, mIRC stops evaluating until the () are balanced again, $+((,$os,),$os) returns "(,$os,)10"