4. When $n$ is a positive integer, the function $f$ satisfies
$$
f(n+3)=\frac{f(n)-1}{f(n)+1}, f(1) \neq 0 \text {, and } f(1) \neq \pm 1 \text {. }
$$

Then $f(1) f(2023)=$ $\qquad$
4. -1 .
Notice that,
$$
\begin{array}{c}
f(n+6)=\frac{f(n+3)-1}{f(n+3)+1} \\
=\frac{\frac{f(n)-1}{f(n)+1}-1}{\frac{f(n)-1}{f(n)+1}+1}=\frac{-1}{f(n)}, \\
f(n+12)=\frac{-1}{f(n+6)}=f(n) .
\end{array}
$$

Thus, $f(n+12k)=f(n)(k \in \mathbf{N})$.
Given $2023=168 \times 12+7$, we have
$$
\begin{array}{l}
f(2023)=f(7)=\frac{-1}{f(1)} \\
\Rightarrow f(1) f(2023)=-1 .
\end{array}
$$