If the handler config is set to only existing, trying to assign a new value to a .code subkey leaves the \pgfkeyscurrentkey macro empty.
Minimal example:
\documentclass{article}
\usepackage{pgfkeys}
\begin{document}
\pgfkeys{/handler config=only existing}
\pgfkeys{/handlers/.unknown/.code='\pgfkeyscurrentkey'}
\pgfkeys{/root/subdir/.code=hello}
\end{document}
Output:
''
Expected output:
'/root/subdir/.code'
See https://github.com/pgf-tikz/pgf/issues/428