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.