Let $X$ be an isolated, Gorenstein singularity of dimension at least $2$ and $\pi: \widetilde{X} \to X$ be a resolution of singularities. Let $E$ be the exceptional divisor and $E\_1,...,E\_r$ be the irreducible components of $E$. Can there exist integers $a\_1,...,a\_r$ not all zero such that $\mathcal{O}\_{\widetilde{X}}(\sum\_i a\_iE\_i) \cong \mathcal{O}\_{\widetilde{X}}$?



Do there exist linear relations between exceptional divisors
I am just posting my comment as an answer. For a quasi-compact, separated, irreducible, smooth $2$-dimensional algebraic space $\widetilde{Y}$ over an algebraically closed field $k$, for a connected, effective Cartier divisor $D$ that is a proper scheme and with irreducible components $(D\_i)\_{i=1,\dots,r}$, there exists a contraction $$f:\widetilde{Y}\to Y,$$ that maps $D$ to a $k$-point $p$ and that is an isomorphism from $\widetilde{Y}\setminus D$ to $Y\setminus\{p\}$ if and only if the following $r\times r$ intersection matrix is negative definite, $$(n\_{i,j})\_{1\leq i,j\leq r}, \ \ n\_{i,j} = (D\_i\cdot D\_j)\_{\widetilde{Y}}.$$  

If $k=\mathbb{C}$ this is originally due to Hans Grauert.


MR0137127   

Grauert, Hans   

Über Modifikationen und exzeptionelle analytische Mengen.   

Math. Ann. 146 (1962), 331–368.


In arbitrary characteristic, this is due to Michael Artin.


MR0146182   

Artin, Michael   

Some numerical criteria for contractability of curves on algebraic surfaces.   

Amer. J. Math. 84 (1962), 485–496.


For $\widetilde{X}$ a quasi-projective, smooth, irreducible $k$-scheme of dimension $n\geq 
 2$, for a connected, effective Cartier divisor $E$ that is a proper scheme and with irreducible components $(E\_i)\_{i=1,\dots,r}$, for a surface $\widetilde{Y}$ in $X$ that is a complete intersection surface of $n-2$ sufficiently general and sufficiently ample divisors, the surface $\widetilde{Y}$ is a quasi-projective, smooth, irreducible $k$-scheme, the divisor $D=\widetilde{Y}\cap E$ in $\widetilde{Y}$ is a connected, effective Cartier divisor, and every divisor $D\_i = \widetilde{Y}\cap E\_i$ in $\widetilde{Y}\_i$ is an irreducible divisor.


If there exists a contraction of $\widetilde{X}$ to an algebraic space that contracts $E$ to a point $p$ and that is an isomorphism outside of $E$, resp. outside of this point, then the restriction of the contraction to $\widetilde{Y}$ is such a contraction. Then the intersection matrix is negative definite. In particular, since the rows (or equivalently, the columns) are linearly independent, it follows that the Cartier divisor classes $[D\_1],\dots,[D\_r]$ in the Néron-Severi group of $\widetilde{Y}$ are linearly independent. Since these are the pullbacks of the Cartier divisor classes $[E\_1],\dots,[E\_r]$ in the Néron-Severi group of $\widetilde{X}$, these classes are also $\mathbb{Z}$-linearly independent.


Finally, even when $\widetilde{X}$ is only quasi-compact, separated, and finitely presented, by Chow's Lemma, there exists a projective morphism,
$$ \rho:\widehat{X}\to \widetilde{X},$$ such that $\widehat{X}$ is quasi-projective. A general complete intersection surface in $\widehat{X}$ need not be smooth. However, we have resolution of singularities for $2$-dimensional schemes over an algebraically closed field, thus we can find a morphism $\widehat{Y}\to \widehat{X}$ playing the same role as the smooth surface above, where $\widehat{Y}$ is a connected, quasi-projective, smooth surface. If there is a nontrivial linear relation among the Cartier divisor classes $[E\_i]$ in $\widetilde{X}$, then this pulls back to a nontrivial linear relation among the pullback Cartier divisor classes on $\widehat{Y}$. By the argument above, the irreducible components of the exceptional locus on $\widehat{Y}$ are $\mathbb{Z}$-linearly independent. So, as above, the Cartier divisor classes $[E\_i]$ in the Néron-Severi group of $\widetilde{X}$ are also $\mathbb{Z}$-linearly independent.


