If $X$ is a noetherian scheme , then for any quasi-coherent sheaf $\mathscr{F}$ on $X$ that satisfies Serre's (S2) condition and an inclusion of an open subscheme $j:U\to X$ with complement of codimension at least 2 then we have $$j\_{\star}j^{\star}\mathscr{F}\cong\mathscr{F}.$$ This is like the Hartogs phenomenon for functions of several complex variables. See for example the explanation here: [Why does the (S2) property of a ring correspond to the Hartogs phenomenon?](https://mathoverflow.net/questions/45347/why-does-the-s2-property-of-a-ring-correspond-to-the-hartogs-phenomenon)


My question is, is there a derived version of this? Namely if one works in the derived category and replace the $j\_\star$ the derived push forward $Rj\_\star$, when do we have
$$Rj\_\star j^\star\mathscr{F}\cong\mathscr{F}?$$


I want to know at least the case where $\mathscr{F}=\mathcal{O}\_X$.



When do we have derived "Hartogs" for quasi-coherent sheaves?
Unfortunately almost never (although it obviously holds if $j^\* \mathcal{F} = 0$). In particular, it virtually never holds for $\mathcal{F} = \mathcal{O}\_X$. I'm going to assume that $\mathcal{F}$ is coherent.


Let me give the quick answer first, then I'll explain it in more detail.


**Quick answer:** $R^i j\_\* j^\* \mathcal{F}$ coincides with $H^{i+1}\_{X \setminus U}(\mathcal{F})$ the $i+1$th cohomology with support at $Z = X \setminus U$ of $\mathcal{F}$. By basic facts about local cohomology, you can basically never expect this to vanish for all $i > 0$. 


**Detailed answer:** Let's suppose that $X = \text{Spec} R$ for simplicity and that $U = X \setminus V(I)$ for some ideal $I$. Further assume that $j^\* M = M|\_U \neq 0$. Let $m$ be a minimal prime of $I$ such that $M\_m \neq 0$. We now can replace $R$ by $R\_m$ and $M$ by $M\_m$. 


Working locally, for any $R$-module $M$ we can identify
$$
R^i j\_\* j^\* M = R^i j\_\* (M|\_U) = H^i(U, M|\_U) = H^{i+1}\_m(M)
$$
for $i > 0$ where $H^\*\_m$ is local cohomology. This comes from the long exact sequence
$$
H^i\_m(M) \to H^i(X, M) = 0 \to H^i(U, M|\_U) \to H^{i+1}\_m(M) \to H^{i+1}(X, M) = 0.
$$


Now, $H^{i+1}\_m(M) \neq 0$ for any $i$ such that $\dim \text{Supp} M = i+1$ by Theorem 3.5.7 in *Cohen-Macaulay Rings* by Bruns and Herzog.


In particular, if $\dim \text{Supp} M \geq 2$, then we have non-vanishing $R^i j\_\* j^\* M$. Now, if $\dim \text{Supp} M = 1$ you can still do something similar (the dimension can't be zero by our previous assumptions). 


In this case, it follows that $H^1\_m(M) \neq 0$ and in fact is infinitely generated. Thus $H^0(U, M|\_U)$ is also infinitely generated since we have the exact sequence
$$
M \to H^0(U, M|\_U) \to H^1\_m(M).
$$


