I have attempted to prove the following, and am wondering if it is correct. Take $U \subseteq \mathbb{C}$ open. Suppose $f: U \to \mathbb{C}$ is holomorphic, and there exists some line segment $L=\{ a+t \lambda: t \in [0,1] \} \subseteq U$ such that $f(L)$ takes on only one value. Then, $f$ is constant on $U$.
My thoughts are as follows:
We may as well define $g(z)=f(z-a)e^{-i \arg(\lambda)}-f(a)$, which will then have this constant line on $[0,R]$ for some $R \in \mathbb{R}$, on which the value is $0$.
$g$ is holomorphic on $g(U)$, so at any point $z \in g(U)$, the Taylor series of $g$ at $z$ converges to $g$ on all of $g(U)$.
$g|_{[0,R]}$ is a continuous, constant function that has image $\{0\}$ and thus will have Taylor series $0$ at, say, $\frac{R}{2}$. This real Taylor series must correspond to $g$'s complex Taylor series at $\frac{R}{2}$. Hence $g \equiv 0$ on $U$.
Hence $f$ is constant.
Is this valid? I'm not confident on my complex analysis abilities, so if there's any part of this proof that asserts something false, I would like to know what I can do.
I think your argument works. However, there is a simpler argument, because essentially what you are saying is that an analytic function on some non-discrete set in some open set extends uniquely to an open set (actually domain). You can simplify your argument by just looking at $f$ and applying your argument.
However, there is a simpler way to show this. You can use the identity-theorem, if you assume that $U$ is contained in some domain $V$ (open, $\neq \varnothing$, connected). Then this analytic function $f:U \to \mathbf{C}$ has the same values as this constant (analytic) function on the line segment which is $\textbf{not}$ discrete in $V$. Therefore by the identity theorem $f$ should be constant on $V$ and thus on $U$ as well.