Closes #3612852
AI-Generated: Yes (For commit 9f1b5771, OpenAI Codex helped reproduce the issue, review and refine the fix, and run tests. The final changes were reviewed and validated by gnuget.)