xcrun xcresulttool Failed to create a new result bundle reader

I need to read results of a test in Xcode post-action of Test.

So the script that runs after tests contains

SUMMARY=$(xcrun xcresulttool get test-results summary --path $RESULT_FILE 2>> "$LOGS")

If I run my script from terminal, everything is ok but if I launch tests and the post-action is executed, I got

Warning: unknown environment variable SWIFT_DEBUG_INFORMATION_FORMAT
Warning: unknown environment variable SWIFT_DEBUG_INFORMATION_VERSION
Warning: unknown environment variable SWIFT_DEBUG_INFORMATION_FORMAT
Warning: unknown environment variable SWIFT_DEBUG_INFORMATION_VERSION
Error: Failed to create a new result bundle reader, underlying error: failed to read metadata with underlying error (type: FileSystemError: 3 - [:] - The operation couldn’t be completed. (MinimalTSCBasic.FileSystemError error 3.)
Usage: xcresulttool <subcommand>
  See 'xcresulttool --help' for more information.

It might be that the environment set by Xcode is missing something but I cannot figure out what, any idea?

What version of Xcode reproduces this issue?

To find out what version of Xcode is being used by your tools, run the following command in Terminal:

xcode-select --print-path
xcrun xcresulttool Failed to create a new result bundle reader
 
 
Q