* handle env exception in gathering even no inject (cherry picked from commit 60e3b9b3527daea6d9fb75a80cc14b35923748f3)