Let $X$ be a CW complex (possibly a topological/smooth manifold) of dimension $n$, $L\to X$ a complex line bundle and $Y\subset X$ a subcomplex (possibly a submanifold) contained in the codimension 3 skeleton of $X$, such that $L$ is trivial on $X-Y$. Is it true in this case that $L$ is trivial on the entire $X$? 


This holds obviously for holomorphic line bundles on smooth varieties, in which case it corresponds to complex codimension 2, but I'd like to be able to replace holomorphic by smooth or continuous. 



Line bundles trivial outside of codimension 3
This will hold for CW structures on manifolds coming from [handle decompositions](https://en.wikipedia.org/wiki/Handle_decomposition), e.g. induced by a [Morse function.](https://en.wikipedia.org/wiki/Handle_decomposition#Morse_theoretic_viewpoint) Complex line bundles on $X$ are classified by the homotopy class of maps to $\mathbb{CP}^{\infty}$, by pulling back the canonical line bundle $\gamma(\mathbb{CP}^\infty)$. Also, $\mathbb{CP}^\infty = K(\mathbb{Z},2)$, so $\pi\_i(\mathbb{CP}^\infty)=0, i > 2$. 


Now, consider a line bundle $L$ on $X$ a manifold with a handle structure, such that $L$ is trivial on $X-Y$, where $Y$ is contained in the codimension 3-skeleton. Flipping the handle structure over (so that $k$-cells become $n-k$ cells), we get a handle structure on $X$ in which the line bundle is trivial on the $3$-skeleton (whose handles correspond dually to handles in $X-Y$). The line bundle $L$ is induced by a map $X\to \mathbb{CP}^\infty$ which is trivial on the $3$-skeleton, and hence may be homotoped to be constant on the 3-skeleton by homotopy extension. Then we may homotope each $i$-cell, $i>3$, to be trivial inductively using the fact that $\pi\_i(\mathbb{CP}^\infty)=0$, until we have homotoped it to a trivial map. So at least this works for handle structures on manifolds. 


**Addendum:** For the case of general CW complexes this will be false. For example, take a non-trivial line bundle over $S^2 \vee S^5$. Then it will be non-trivial over $S^2$ and trivial over $S^5$, since again $\pi\_5(\mathbb{CP}^\infty)=0$. However, this line bundle is trivial on the complement of the codimension-3 skeleton which is $S^2$. 


