# Formal vs analytic trivializations of line bundles

Let $X$ be a smooth complex projective variety. Let $Y$ be a smooth divisor on $X$, and let $\mathfrak X$ be the formal completion of $X$ along $Y$.

Question. If $\mathcal L$ is a line bundle on $X$ which restricts to a trivial line bundle on $\mathfrak X$, can we say that $\mathcal L$ is trivial on an open subset $U\subset X$ (Zariski or Euclidean) containing $Y$?

I am particularly interested in the case the normal bundle of $Y$ is trivial or, more generally, numerically trivial.

-
If $X$ is of dimension at least $4$ and $Y$ is ample, this follows from the Grothendieck-Lefschetz theorem for Picard groups. – Daniel Litt Jun 9 '14 at 3:50