While working on an exercise, I came up with something that seems like a contradiction and I don't seem to find out why one of my two reasoning is wrong.
Consider $X = \mathbb{P}^1_k$ and $Z = P_1\cup\ldots\cup P_n$ where $P_i$ is a closed point of $\mathbb{P}^1_k$. I wanted to find the dimension of $H^0(X,\iota_*\mathcal{O}_Z)$ as a $k$-vector space.
From one side, I get that $H^0(X,\iota_*\mathcal{O}_Z)\cong\Gamma(Z,\mathcal{O}_Z)=\mathcal{O}_{X,P_1}\oplus\ldots\oplus\mathcal{O}_{X,P_n}$. But we have that $\mathcal{O}_{X,P_i}\cong k[t]_{(t)}$ as a $k$-algebra. Sice $k[t]_{(t)}$ is infinite dimensional, so is $H^0(X,\iota_*\mathcal{O}_Z).$
From the other side, we have that $\iota$ is a proper morphism (as it is projective) and so $\iota_*\mathcal{O}_Z$ is coherent on $\mathbb{P}^1_k$. So $H^p(X,\iota_*\mathcal{O}_Z)$ is a finite dimensional vector space according to https://stacks.math.columbia.edu/tag/02O3 (similar results can be found in Hartshorne) for all $p\geq 0$.
What of this two sides is wrong ? I really can't seem to wrap my head around it... Thanks in advance for any answer.
EDIT: $k$ is an algebraically closed scheme and $\iota:Z\rightarrow X$ is the inclusion.