This means that the indices on the left-hand side and the right-hand side of a replacement rule do not match. For instance,
ex:=A_{m n};
substitute(ex, $A_{m n} = B_{m}$);
You would mess up your equations if it would allow such substitutions.
You can do this if you really want to, by using the ->
notation,
substitute(ex, $A_{m n} -> B_{m}$);
This will work (but may of course still be wrong).
If you don't get the error from something like this, please post a minimal example.