Add diagnostic output for debugging failures