add debug logging for api failures