  [Abridged] The occurrence rate of observed sub-Neptunes has a break at 0.1
au, which is often attributed to a migration trap at the inner rim of
protoplanetary disks where a positive co-rotation torque prevents inward
migration. We argue that conditions in inner disk regions are such that
sub-Neptunes are likely to open gaps, lose the support of the co-rotation
torque as their co-rotation regions become depleted, and the trapping
efficiency then becomes uncertain. We study what it takes to trap such
gap-opening planets at the inner disk rim. We performed 2D locally isothermal
and non-isothermal hydrodynamic simulations of planet migration. A viscosity
transition was introduced in the disk to (i) create a density drop and (ii)
mimic the viscosity increase as the planet migrated from a dead zone towards a
region with active magneto-rotational instability (MRI). We chose TOI-216b as a
Neptune-like upper-limit test case, but we also explored different planetary
masses, both on fixed and evolving orbits. For planet-to-star mass ratios
$q\simeq(4$-$8)\times10^{-5}$, the density drop at the disk rim becomes
reshaped due to a gap opening and is often replaced with a small density bump
centered on the planet's corotation. Trapping is possible only if the bump
retains enough gas mass and if the co-rotation region becomes azimuthally
asymmetric, with an island of librating streamlines that accumulate a gas
overdensity ahead of the planet. The overdensity exerts a positive torque that
can counteract the negative torque of spiral arms. In our model, efficient
trapping depends on the $\alpha$ viscosity and its contrast across the
viscosity transition. In order to trap TOI-216b, $\alpha_{\mathrm{DZ}}=10^{-3}$
in the dead zone requires $\alpha_{\mathrm{MRI}}\gtrsim5\times10^{-2}$ in the
MRI-active zone. If $\alpha_{\mathrm{DZ}}=5\times10^{-4}$,
$\alpha_{\mathrm{MRI}}\gtrsim7.5\times10^{-2}$ is needed.
