Package installation on macOS is failing due to a com.apple.appstored.xpc exception - MDM

When a package is published via MDM using the Install Enterprise app command provided by Apple

On one of the devices, this command is failing with com.apple.appstored.xpc exception but works fine on other macOS devices having the same restrictions and OS version. We tried restarting the device and also the appstored process via Activity Monitor but it was in vain.

I am attaching system logs that contain the exception and stack trace when the command failed.

default	13:05:35.027306+0530	mdmclient	[0:MDMDaemon:HTTPUtil:<0x5d27>] <<<<< Received HTTP response (200) [Idle] <<<<<\
default	13:05:35.029995+0530	mdmclient	[0:MDMDaemon:<0x5d27>] Processing server request: InstallApplication for:  (2451936) PowerNap: no\
default	13:05:35.030620+0530	mdmclient	[0:MDMDaemon:<0x5d27>] MDM BootstrapToken support: ServerCapabilities\
error	13:05:35.034204+0530	kernel	System Policy: sentineld_helper(590) deny(1) file-read-metadata /private/var/db/ConfigurationProfiles/Store/MDM_ComputerPrefs.plist\
error	13:05:35.034264+0530	kernel	System Policy: sentineld_helper(590) deny(1) file-read-data /private/var/db/ConfigurationProfiles/Store/MDM_ComputerPrefs.plist\
default	13:05:35.043207+0530	mdmclient	[0:MDMDaemon:ManagedApps:<0x5d27>] StartInstall using UUID: 37F0D2E9-D57A-4857-8042-3553C8D41B36 for MDM 'com.mobilock.mdm'\
default	13:05:35.043473+0530	mdmclient	[0:MDMDaemon:ManagedApps:<0x5d27>] Installing with MDM options: \{\
    ManagementFlags = 5;\
    ManifestURL = "URL-Redacted-For-Privacy";\
    RequestType = InstallApplication;\
\}\
default	13:05:35.044958+0530	mdmclient	[0:MDMDaemon:InstallApplication:<0x5d27>] InstallApplication (UUID:37F0D2E9-D57A-4857-8042-3553C8D41B36) (iOS: no) manifest: (null)\
default	13:05:35.045289+0530	mdmclient	[0:MDMDaemon:AppStore:<0x5d27>] Calling AppStore -submitManifestRequest.  ID: 37F0D2E9-D57A-4857-8042-3553C8D41B36  Platform:   Manifest: no  URL: YES  Certs: no  Pinning: no\
default	13:05:35.047281+0530	mdmclient	[0x15573cea0] activating connection: mach=true listener=false peer=false name=com.apple.appstoreagent.xpc\
default	13:05:35.047622+0530	mdmclient	[0x15573cea0] failed to do a bootstrap look-up: xpc_error=[3: No such process]\
default	13:05:35.047668+0530	mdmclient	[0x15573cea0] invalidated after a failed init\
error	13:05:35.047888+0530	mdmclient	[ASDServiceBroker]: Connection invalidated\
default	13:05:35.048202+0530	mdmclient	[0x15689bd40] activating connection: mach=true listener=false peer=false name=com.apple.appstored.xpc\
default	13:05:35.049253+0530	appstored	(XPCServiceClient) Received connection from client: com.apple.mdmclient\
default	13:05:35.050997+0530	appstored	[9B953BCE] Manifest request submitted by: com.apple.mdmclient\
fault	13:05:36.928968+0530	mdmclient	 connection to service with pid 1414 named com.apple.appstored.xpc: Exception caught during decoding of reply to message 'submitManifestRequest:withReplyHandler:', dropping incoming message and calling failure block.\
\
Ignored Exception: Exception while decoding argument 0 (#1 of invocation):\
\
return value: \{v\} void\
target: \{@?\} 0x0 (block)\
argument 1: \{@\} 0x0\
argument 2: \{@\} 0x0\
\
Exception: value for key 'NS.objects' was of unexpected class 'NSUUID' (0x1f2a38a80) [/System/Library/Frameworks/Foundation.framework].\
Allowed classes are:\
 \{(\
    "'NSDictionary' (0x1f2a31578) [/System/Library/Frameworks/CoreFoundation.framework]",\
    "'NSData' (0x1f2a31500) [/System/Library/Frameworks/CoreFoundation.framework]",\
    "'NSError' (0x1f2a37e50) [/System/Library/Frameworks/Foundation.framework]",\
    "'NSString' (0x1f2a388c8) [/System/Library/Frameworks/Foundation.framework]",\
    "'NSArray' (0x1f2a31438) [/System/Library/Frameworks/CoreFoundation.framework]",\
    "'NSURL' (0x1f2a31910) [/System/Library/Frameworks/CoreFoundation.framework]",\
    "'NSDate' (0x1f2a31528) [/System/Library/Frameworks/CoreFoundation.framework]",\
    "'NSNumber' (0x1f2a383c8) [/System/Library/Frameworks/Foundation.framework]"\
)\}\
(\
	0   CoreFoundation                      0x000000018ae5eccc __exceptionPreprocess + 176\
	1   libobjc.A.dylib                     0x000000018a946788 objc_exception_throw + 60\
	2   Foundation                          0x000000018bedeb18 -[NSXPCDecoder _validateAllowedClass:forKey:allowingInvocations:] + 432\
	3   Foundation                          0x000000018c745514 _decodeObject + 1200\
	4   Foundation                          0x000000018beec714 __44-[NSXPCDecoder _decodeArrayOfObjectsForKey:]_block_invoke + 52\
	5   Foundation                          0x000000018bee3ac8 _NSXPCSerializationIterateArrayObject + 208\
	6   Foundation                          0x000000018bee39c4 -[NSXPCDecoder _decodeArrayOfObjectsForKey:] + 240\
	7   Foundation                          0x000000018bed0cb8 -[NSDictionary(NSDictionary) initWithCoder:] + 152\
	8   Foundation                          0x000000018c745554 _decodeObject + 1264\
	9   Foundation                          0x000000018c745940 _decodeObjectAfterSettingAllowListForKey + 168\
	10  Foundation                          0x000000018bef7f14 -[NSXPCDecoder decodeObjectOfClasses:forKey:] + 52\
	11  Foundation                          0x000000018bf17ac0 -[NSError initWithCoder:] + 428\
	12  Foundation                          0x000000018c745554 _decodeObject + 1264\
	13  Foundation                          0x000000018bede88c -[NSXPCDecoder _decodeObjectOfClasses:atObject:] + 76\
	14  Foundation                          0x000000018bede35c _NSXPCSerializationDecodeTypedObjCValuesFromArray + 892\
	15  Foundation                          0x000000018beddd64 _NSXPCSerializationDecodeInvocationArgumentArray + 412\
	16  Foundation                          0x000000018c745cd8 -[NSXPCDecoder __decodeXPCObject:allowingSimpleMessageSend:outInvocation:outArguments:outArgumentsMaxCount:outMethodSignature:outSelector:isReply:replySelector:] + 700\
	17  Foundation                          0x000000018c7459f0 -[NSXPCDecoder _decodeReplyFromXPCObject:forSelector:] + 76\
	18  Foundation                          0x000000018bedd360 -[NSXPCConnection _decodeAndInvokeReplyBlockWithEvent:sequence:replyInfo:] + 252\
	19  Foundation                          0x000000018bedcdc8 __88-[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:]_block_invoke_3 + 188\
	20  libxpc.dylib                        0x000000018aa1a848 _xpc_connection_reply_callout + 116\
	21  libxpc.dylib                        0x000000018aa1a740 _xpc_connection_call_reply_async + 80\
	22  libdispatch.dylib                   0x000000018ab5a468 _dispatch_client_callout3 + 20\
	23  libdispatch.dylib                   0x000000018ab77fc8 _dispatch_mach_msg_async_reply_invoke + 344\
	24  libdispatch.dylib                   0x000000018ab61898 _dispatch_lane_serial_drain + 368\
	25  libdispatch.dylib                   0x000000018ab62578 _dispatch_lane_invoke + 432\
	26  libdispatch.dylib                   0x000000018ab6d2d0 _dispatch_root_queue_drain_deferred_wlh + 288\
	27  libdispatch.dylib                   0x000000018ab6cb44 _dispatch_workloop_worker_thread + 404\
	28  libsystem_pthread.dylib             0x000000018ad0700c _pthread_wqthread + 288\
	29  libsystem_pthread.dylib             0x000000018ad05d28 start_wqthread + 8\
)\
(\
	0   CoreFoundation                      0x000000018ae5eccc __exceptionPreprocess + 176\
	1   libobjc.A.dylib                     0x000000018a946788 objc_exception_throw + 60\
	2   Foundation                          0x000000018beddfcc _NSXPCSerializationDecodeInvocationArgumentArray + 1028\
	3   Foundation                          0x000000018c745cd8 -[NSXPCDecoder __decodeXPCObject:allowingSimpleMessageSend:outInvocation:outArguments:outArgumentsMaxCount:outMethodSignature:outSelector:isReply:replySelector:] + 700\
	4   Foundation                          0x000000018c7459f0 -[NSXPCDecoder _decodeReplyFromXPCObject:forSelector:] + 76\
	5   Foundation                          0x000000018bedd360 -[NSXPCConnection _decodeAndInvokeReplyBlockWithEvent:sequence:replyInfo:] + 252\
	6   Foundation                          0x000000018bedcdc8 __88-[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:]_block_invoke_3 + 188\
	7   libxpc.dylib                        0x000000018aa1a848 _xpc_connection_reply_callout + 116\
	8   libxpc.dylib                        0x000000018aa1a740 _xpc_connection_call_reply_async + 80\
	9   libdispatch.dylib                   0x000000018ab5a468 _dispatch_client_callout3 + 20\
	10  libdispatch.dylib                   0x000000018ab77fc8 _dispatch_mach_msg_async_reply_invoke + 344\
	11  libdispatch.dylib                   0x000000018ab61898 _dispatch_lane_serial_drain + 368\
	12  libdispatch.dylib                   0x000000018ab62578 _dispatch_lane_invoke + 432\
	13  libdispatch.dylib                   0x000000018ab6d2d0 _dispatch_root_queue_drain_deferred_wlh + 288\
	14  libdispatch.dylib                   0x000000018ab6cb44 _dispatch_workloop_worker_thread + 404\
	15  libsystem_pthread.dylib             0x000000018ad0700c _pthread_wqthread + 288\
	16  libsystem_pthread.dylib             0x000000018ad05d28 start_wqthread + 8\
)\
error	13:05:36.930100+0530	mdmclient	[ERROR] [0:MDMDaemon:AppStore:<0x5d28>] submitManifestRequest completed.  ID: 37F0D2E9-D57A-4857-8042-3553C8D41B36 Error: Error Domain=NSCocoaErrorDomain Code=4101 "connection to service with pid 1414 named com.apple.appstored.xpc" UserInfo=\{NSDebugDescription=connection to service with pid 1414 named com.apple.appstored.xpc\}\
default	13:05:36.930293+0530	mdmclient	[0:MDMDaemon:ManagedApps:<0x5d27>] Logging Manifest request failure.  InstallUUID: 37F0D2E9-D57A-4857-8042-3553C8D41B36  Error: Error Domain=NSCocoaErrorDomain Code=4101 "connection to service with pid 1414 named com.apple.appstored.xpc" UserInfo=\{NSDebugDescription=connection to service with pid 1414 named com.apple.appstored.xpc, NSLocalizedDescription=connection to service with pid 1414 named com.apple.appstored.xpc, UsedNSDebugDescription=true\}\
default	13:05:36.930577+0530	mdmclient	[0x15561f340] activating connection: mach=true listener=false peer=false name=com.apple.mdmclient.daemon.unrestricted\
default	13:05:36.933142+0530	mdmclient	[0x15561f690] activating connection: mach=false listener=false peer=true name=com.apple.mdmclient.daemon.unrestricted.peer[2614].0x15561f690\
default	13:05:36.933403+0530	mdmclient	[0:MDMDaemon:<0x5d28>] ### XPC request (unrestricted): ManagedAppsUnrestricted:ManagedAppsInstallPhase ### from: \
default	13:05:36.933850+0530	mdmclient	[0:MDMDaemon:ManagedApps:<0x5d28>] Processing install phase 97 for 37F0D2E9-D57A-4857-8042-3553C8D41B36 ==> \{\
    "__Error__" =     \{\
        code = 4101;\
        domain = NSCocoaErrorDomain;\
        userInfo =         \{\
            NSDebugDescription = "connection to service with pid 1414 named com.apple.appstored.xpc";\
            NSLocalizedDescription = "connection to service with pid 1414 named com.apple.appstored.xpc";\
            UsedNSDebugDescription = 1;\
        \};\
    \};\
    "__Success__" = 0;\
\}\
error	13:05:36.935661+0530	mdmclient	[ERROR] [0:MDMDaemon:ManagedApps:<0x5d28>] Aborting app install: Error Domain=NSCocoaErrorDomain Code=4101 "connection to service with pid 1414 named com.apple.appstored.xpc" UserInfo=\{NSDebugDescription=connection to service with pid 1414 named com.apple.appstored.xpc, NSLocalizedDescription=connection to service with pid 1414 named com.apple.appstored.xpc, UsedNSDebugDescription=true\}\
default	13:05:36.935710+0530	mdmclient	[0:MDMDaemon:ManagedApps:<0x5d28>] Install phase 97 (37F0D2E9-D57A-4857-8042-3553C8D41B36) completed. Result:  ==> Error Domain=NSCocoaErrorDomain Code=4101 "connection to service with pid 1414 named com.apple.appstored.xpc" UserInfo=\{NSDebugDescription=connection to service with pid 1414 named com.apple.appstored.xpc, NSLocalizedDescription=connection to service with pid 1414 named com.apple.appstored.xpc, UsedNSDebugDescription=true\}\
default	13:05:36.937370+0530	mdmclient	[0x15561f340] invalidated because the current process cancelled the connection by calling xpc_connection_cancel()\
default	13:05:36.937391+0530	mdmclient	[0x15561f690] invalidated after getting a no-senders notification - client is gone\
default	13:05:36.937577+0530	mdmclient	[0x15561fe90] activating connection: mach=true listener=false peer=false name=com.apple.mdmclient.daemon.unrestricted\
default	13:05:36.939795+0530	mdmclient	[0x15691c090] activating connection: mach=false listener=false peer=true name=com.apple.mdmclient.daemon.unrestricted.peer[2614].0x15691c090\
default	13:05:36.940006+0530	mdmclient	[0:MDMDaemon:<0x5d29>] ### XPC request (unrestricted): ManagedAppsUnrestricted:ManagedAppsInstallPhase ### from: \
default	13:05:36.940314+0530	mdmclient	[0:MDMDaemon:ManagedApps:<0x5d29>] Processing install phase 98 for 37F0D2E9-D57A-4857-8042-3553C8D41B36 ==> (null)\
default	13:05:36.941518+0530	mdmclient	[0:MDMDaemon:ManagedApps:<0x5d29>] Install '37F0D2E9-D57A-4857-8042-3553C8D41B36' finished.  Sucess: no  Error: \{\
    code = 4101;\
    domain = NSCocoaErrorDomain;\
    userInfo =     \{\
        NSDebugDescription = "connection to service with pid 1414 named com.apple.appstored.xpc";\
        NSLocalizedDescription = "connection to service with pid 1414 named com.apple.appstored.xpc";\
        UsedNSDebugDescription = 1;\
    \};\
\}\
default	13:05:36.941560+0530	mdmclient	[0:MDMDaemon:<0x5d29>] === CPF_GetInstalledProfiles === ()\
default	13:05:36.941669+0530	mdmclient	[0x155625720] activating connection: mach=true listener=false peer=false name=com.apple.mdmclient.daemon\
default	13:05:36.943753+0530	mdmclient	[0x155625ab0] activating connection: mach=false listener=false peer=true name=com.apple.mdmclient.daemon.peer[2614].0x155625ab0\
default	13:05:36.943916+0530	mdmclient	[0:MDMDaemon:<0x5d28>] ### XPC request: GetInstalledProfiles ### from: \
default	13:05:36.955056+0530	mdmclient	[0x155625720] invalidated because the current process cancelled the connection by calling xpc_connection_cancel()\
default	13:05:36.955148+0530	mdmclient	[0x155625ab0] invalidated after getting a no-senders notification - client is gone\
default	13:05:36.958087+0530	mdmclient	[0:MDMDaemon:<0x5d29>] Number of  profiles found: 12 (Filtered: 0)\
default	13:05:36.958281+0530	mdmclient	[0:MDMDaemon:ManagedApps:<0x5d29>] Clearing managed apps for profile: National Payments Corporation of India (com.mobilock.mdm:db3adca9-e6ac-4ebf-a158-5c54def8bd87)  (filter: \{\
    LimitToInstallUUID = "37F0D2E9-D57A-4857-8042-3553C8D41B36";\
\})\
default	13:05:36.963463+0530	mdmclient	[0:MDMDaemon:ManagedApps:<0x5d29>] Install phase 98 (37F0D2E9-D57A-4857-8042-3553C8D41B36) completed. Result:  ==> Final Cleanup\
default	13:05:36.965933+0530	mdmclient	[0x15561fe90] invalidated because the current process cancelled the connection by calling xpc_connection_cancel()\
default	13:05:36.966209+0530	mdmclient	[0x15691c090] invalidated after getting a no-senders notification - client is gone\
error	13:05:36.966578+0530	mdmclient	[ERROR] [0:MDMDaemon:InstallApplication:<0x5d27>] AppStore manifest request failed ==> Error Domain=NSCocoaErrorDomain Code=4101 "connection to service with pid 1414 named com.apple.appstored.xpc" UserInfo=\{NSDebugDescription=connection to service with pid 1414 named com.apple.appstored.xpc, NSLocalizedDescription=connection to service with pid 1414 named com.apple.appstored.xpc, UsedNSDebugDescription=true\}\
error	13:05:36.967334+0530	mdmclient	[ERROR] [0:MDMDaemon:<0x5d27>] [ErrorChain.0] (InstallApplication) [NSCocoaErrorDomain:4101] connection to service with pid 1414 named com.apple.appstored.xpc>\
default	13:05:36.971328+0530	mdmclient	CSSM Exception: -2147415780 CSSMERR_CSP_INVALID_KEYATTR_MASK\
error	13:05:36.971857+0530	kernel	System Policy: sentineld_helper(590) deny(1) file-read-metadata /private/var/db/ConfigurationProfiles/Store/MDM_ComputerPrefs.plist\
error	13:05:36.971892+0530	kernel	System Policy: sentineld_helper(590) deny(1) file-read-data /private/var/db/ConfigurationProfiles/Store/MDM_ComputerPrefs.plist\
default	13:05:36.973778+0530	mdmclient	CSSM Exception: -2147415780 CSSMERR_CSP_INVALID_KEYATTR_MASK\
default	13:05:36.977813+0530	mdmclient	Trust evaluate failure: [leaf MissingIntermediate]\
default	13:05:37.002309+0530	mdmclient	[0:MDMDaemon:HTTPUtil:<0x5d27>] >>>>> Sending HTTP request (PUT) [Error(InstallApplication):2451936] >>>>>\

Sorry, there is a mistake in the above description. We do not use the Install Enterprise app command. Instead, we use the Install an App command with the ManifestURL supplied in the command

Package installation on macOS is failing due to a com.apple.appstored.xpc exception - MDM
 
 
Q