When we do set theory, we take our first-order variables to range over all sets. But if we take our second-order variables to range over sets of sets in the range of the first-order variables, then second-order comprehension will fail. A simple instance of second-order comprehension such as $\exists X\forall y (Xy \longleftrightarrow y \not\in y)$ will be false on account of Russell’s paradox, according to which no set contains all and only those sets that are not members of themselves.
This doesn't seem correct, but I don't see how it can be avoided without bringing in a class/set distinction which isn't in the axiom as presented in shaprio 1991 for example.
In Second-order Logic, the comprehension schema (considering for simplicity only unary predicate variables) is:
where $x$ is an individual variable, $X$ is a unary predicate variable and $X$ does not occur free in $\varphi$.
What prevents form generating inconsistencies ?
The proviso that $X$ is not free in $\varphi$ prevents from using $\lnot X(x)$ to get:
$∃X∀x [ \lnot X(x) ↔ X(x) ]$.