When you use alternatives in patterns, you should make sure that the same set of names appear in each alternative. When a pattern like
(a[x_]|b[x_]) matches an expression, there will always be a definite expression that corresponds to the object
x. If you try to match a pattern like
(a[x_]|b[y_]), then there still will be definite expressions corresponding to
x and
y, but the unmatched one will be
Sequence[ ].