web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

An unexpected error occurred from ISV code. (ErrorType = ClientError)

(3) ShareShare
ReportReport
Posted on by 95
Getting a below error while executing a sandboxed custom code activity on MS on prem v9.1, which contains a HttpClient and running a rest service, and BTW it's working only on non-sandbox Getting this error, I need to understand this behaviour, as running Http/HTTPS from sandbox, it's running normally as per articles with no limitations. 
And the idea for running a sandbox to get the OOB trace log as none not logging anything else.
 
here are the tarcing 
Unhandled exception:
Exception type: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]
Message: An unexpected error occurred from ISV code. (ErrorType = ClientError) Unexpected exception from plug-in (Execute): MOT.CRM.CustomCS.Common.ExecuteRestAPI: System.Activities.InvalidWorkflowException: One or more errors occurred.Detail:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ActivityId>46f8c131-37c9-4a9a-8a62-abc982574a48</ActivityId>
<ErrorCode>-2147220956</ErrorCode>
<ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<HelpLink i:nil="true" />
<Message>An unexpected error occurred from ISV code. (ErrorType = ClientError) Unexpected exception from plug-in (Execute): MOT.CRM.CustomCS.Common.ExecuteRestAPI: System.Activities.InvalidWorkflowException: One or more errors occurred.</Message>
<Timestamp>2025-06-02T12:15:33.7265684Z</Timestamp>
<ExceptionRetriable>false</ExceptionRetriable>
<ExceptionSource>PluginExecution</ExceptionSource>
<InnerFault i:nil="true" />
<OriginalException>System.Activities.InvalidWorkflowException
at System.Activities.WorkflowApplication.Invoke(Activity activity, IDictionary`2 inputs, WorkflowInstanceExtensionManager extensions, TimeSpan timeout)
at System.Activities.WorkflowInvoker.Invoke(Activity workflow, IDictionary`2 inputs, TimeSpan timeout, WorkflowInstanceExtensionManager extensions)
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Crm.Sandbox.SandboxAppDomainHelper.Execute(IOrganizationServiceFactory organizationServiceFactory, String customActivityTypeName, IExecutionContext requestContext, Dictionary`2 sandboxServices, Boolean useDrawbridgeEnabled, Boolean chaosFailAppDomain)
at Microsoft.Crm.Sandbox.SandboxAppDomainHelper.Execute(IOrganizationServiceFactory organizationServiceFactory, String customActivityTypeName, IExecutionContext requestContext, Dictionary`2 sandboxServices, Boolean useDrawbridgeEnabled, Boolean chaosFailAppDomain)
at Microsoft.Crm.Sandbox.SandboxWorker.&lt;&gt;c__DisplayClass10_0.&lt;ExecuteCustomWorkflowActivity&gt;b__0()</OriginalException>
<TraceText>
Entering Execution...
Request Url: https://crm.mot.gov.sa/MOTCRMPROD365/api/data/v9.1/accounts(E0D2A459-C083-EE11-8EAB-005056A07F46)?$select=accountid
Request Body:
Header X-API-KEY
Value 1020304050
Starting async GET request
Aggregate Exception: An error occurred while sending the request.
HTTP request error: An error occurred while sending the request.
Inner HTTP Request Exception: Unable to connect to the remote server
StackTrace:
Data: System.Collections.ListDictionaryInternal
HelpLink:
</TraceText>
</OrganizationServiceFault>
Categories:
I have the same question (0)
  • Suggested answer
    DAnny3211 Profile Picture
    11,417 Super User 2026 Season 1 on at

    Hi,

     

    The error you're encountering—"An unexpected error occurred from ISV code. (ErrorType = ClientError)"—while executing a sandboxed custom code activity that uses HttpClient in Dynamics 365 on-premises v9.1, is likely due to network restrictions or sandbox limitations, despite documentation suggesting HTTP/HTTPS calls are allowed.

     

    Here’s a breakdown of what might be happening and how to approach it:

     
     

    Understanding the Behavior

     

    1. Sandbox Limitations:

       

      • While sandboxed plugins can technically make HTTP/HTTPS calls, they are subject to strict security and network constraints.

      • On-premises environments may have firewall rules, proxy settings, or DNS resolution issues that block outbound calls from the sandbox.

    2. Error Details:

       

      • The trace shows:

        Inner HTTP Request Exception: Unable to connect to the remote server

        This suggests a network-level failure, not a code issue.

    3. Non-Sandbox Success:

       

      • The fact that it works in non-sandboxed mode confirms that the code is correct, but the sandbox environment lacks the necessary network access.


    4.  
     
     

    Recommendations

     

    1. Use Non-Sandboxed Plugin:

       

      • If trace logging is not critical, consider running the plugin in non-isolated mode, especially for external service calls.

    2. Use Azure Function or External Proxy:

       

      • Offload the HTTP call to an Azure Function or external service that your plugin can call indirectly, reducing sandbox dependency.

    3. Check Network Configuration:

       

      • Ensure the sandbox worker process has access to the internet or the target endpoint.

      • Review proxy settings, firewall rules, and DNS resolution for the sandboxed service account.

    4. Enable Trace Logging via Custom Telemetry:

       

      • If you need trace logs, consider implementing custom logging to a secure endpoint or database, rather than relying solely on sandbox traces.


    5.  
     
     

    Please verify if this helps clarify the issue and guide your next steps.

     

    Thanks and best regards,

    Daniele

    Note: This response was prepared with support from Copilot to ensure clarity and completeness.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
11manish Profile Picture

11manish 156

#2
Pallavi Phade Profile Picture

Pallavi Phade 102 Super User 2026 Season 1

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 55 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans