Let $X$ be a normal complex affine algebraic variety. Suppose that $Y$ is an open subvariety of $X$, and that the codimension of $X\setminus Y$ in $X$ is at least $2$. One version of the Hartogs Theorem is that the restriction map $\mathbb{C}[X]\rightarrow\mathbb{C}[Y]$ is surjective. I am curious about whether there is a version of the Hartogs Theorem for extending sections of canonical bundles. Specifically, if $\alpha$ is a global section of the canonical bundle on $Y$, does there exist a global section $\beta$ of the canonical bundle on $X$ such that $\beta\vert\_Y=\alpha$? I would appreciate any and all references and suggestions.



Hartogs Theorem and Canonical Bundles
I think the property you want is that the canonical sheaf $\omega\_X$ is S2. Note that on a normal affine variety, $\omega\_X$ is *not* necessarily a line bundle (it is if $X$ is a complete intersection though). 


For simplicity, let's assume $X \subseteq A^{n}$ is of dimension $d$. Then 
$$
\omega\_X = Ext^{n-d}(O\_X, O\_{A^{n}})
$$
is a S2 sheaf. This implies that it satisfies Hartog's theorem. Not all sheaves do! For example, the ideal sheaf of a maximal ideal obviously does not (assuming $\dim X \geq 2$).


For a reference which discusses the S2 condition and relation to Hartog's phenomenon, see for example


Hartshorne, *Generalized divisors on Gorenstein schemes*. 


I think Sándor Kovács has also written several good answers explaining this connection on mathoverflow.


A proof of the S2ness of $\omega\_X$ for varieties can be found in Kollár-Mori, *Birational geometry of algebraic varieties*. Another proof can be found in Hartshorne's *Generalized divisors and biliaison*.


