xcodebuild Uncaught Exception: Couldn't posix_spawn: error 7

I've been trying to build my project with xcodebuild, but keep getting this error:

User defaults from command line:
    arch = arm64
    sdk = iphoneos

Build settings from command line:
    CODE_SIGNING_ALLOWED = NO

** INTERNAL ERROR: Uncaught exception **
Uncaught Exception: Couldn't posix_spawn: error 7
Stack:
  0   __exceptionPreprocess (in CoreFoundation)
  1   objc_exception_throw (in libobjc.A.dylib)
  2   -[NSConcreteTask launchWithDictionary:error:] (in Foundation)
  3   __46-[IDEShellScriptExecutionActionOperation main]_block_invoke.212 (in IDEStandardExecutionActionsCore)
  4   __DVT_CALLING_CLIENT_BLOCK__ (in DVTFoundation)
  5   ___DVTAsyncPerformBlockOnMainRunLoop_block_invoke (in DVTFoundation)
  6   __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ (in CoreFoundation)
  7   __CFRunLoopDoBlocks (in CoreFoundation)
  8   __CFRunLoopRun (in CoreFoundation)
  9   CFRunLoopRunSpecific (in CoreFoundation)
 10   CFRunLoopRun (in CoreFoundation)
 11   -[Xcode3CommandLineBuildTool _buildWithTimingSection:] (in Xcode3Core)
 12   -[Xcode3CommandLineBuildTool run] (in Xcode3Core)
 13   main (in xcodebuild)
 14   start (in libdyld.dylib)

I think this error is related to the script in the pre-action. When I remove all the scripts in the pre-action, or select None in the "provide build settings from", the project can be compiled normally. But when I select one included in If the scheme in the project is used as a parameter, this error will be reported.

xcodebuild Uncaught Exception: Couldn't posix_spawn: error 7
 
 
Q