I want to save a path, draw it cropped and put an arrow on it
\documentclass[10pt,convert={convertexe=magick,density=1000,outext=.png}]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}
\path[save path=\test] (0,0) -- (5,5);
\node at (0,0) {origin};
\begin{scope}
\clip (1,1) rectangle (4,4);
\draw[decorate,decoration={markings,mark=at position 0.5 with {\arrow{stealth}}}][use path=\test];
\end{scope}
\end{tikzpicture}
\end{document}
Well, putting arrow does not work, because I get the message
! Package pgf Error: I cannot decorate an empty path.
What is a workaround for this problem?

\newcommand{\test}{ (0,0) -- (5,5) }instead of saving the path. I also found these answers that might be helpful: https://tex.stackexchange.com/a/127045/47927 and https://tex.stackexchange.com/a/26386/47927 – Jasper Habicht Jul 12 '22 at 21:11