Improved error handling for process attachment