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

Community site session details

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

LocalAgentCommon.LocalAgentInvalidOperationException

(0) ShareShare
ReportReport
Posted on by 8
 
LocalAgentCommon.LocalAgentInvalidOperationException: Unable to cleanup modules
at
Microsoft.Dynamics.LocalAgent.OrchestrationService.Tasks.CleanupModulesRunnerTask.Run(OrchestratorRunbookResource
runbookResource, String commandId, String jobId, String runbookTaskId) at
Microsoft.Dynamics.LocalAgent.OrchestrationService.OrchestrationJobManager
Categories:
I have the same question (0)
  • Suggested answer
    DAnny3211 Profile Picture
    10,791 Moderator on at
    LocalAgentCommon.LocalAgentInvalidOperationException

    Hi,

     

    The error LocalAgentCommon.LocalAgentInvalidOperationException: Unable to cleanup modules in Dynamics 365 Finance and Operations (on-premises) typically occurs during servicing or deployment cleanup operations. This is often related to issues with the Local Agent, Service Fabric, or module dependencies.

     

    Here’s how you can troubleshoot and resolve it:

     
     

    1. Review Service Fabric and Local Agent Logs

     

    • Use Service Fabric Explorer to identify the primary orchestrator node.

    • On that node, check logs under:
      Event Viewer > Applications and Services Logs > Microsoft > Dynamics > AX-LocalAgent

    • Look for detailed error messages under the Details tab [1].


    •  
     
     

    2. Run Cleanup Commands Properly

     

    • Use the Local Agent CLI to run cleanup:
      .\LocalAgentCLI.exe Cleanup "<path to localagent-config.json>"
      

    • Ensure you're not running cleanup during an active servicing operation [2].


    •  
     
     

    3. Check for Module Dependencies

     

    • The error may be caused by missing or improperly referenced modules.

    • If you're deploying a package, ensure all dependent modules are included.

    • Alternatively, remove modules that require dependencies not present in the package [1].


    •  
     
     

    4. Address Common Deployment Failures

     

    • Low disk space or locked files can cause cleanup failures.

    • Check and clean up:

      • J:\MonAgentData\SingleAgent\Tables

      • DeployablePackages folder (remove old packages)

      • Empty the recycle bin [3].


    •  
     
     

    5. Update the Local Agent

     

    • Ensure you're using the latest version of the Local Agent compatible with your Service Fabric cluster.

    • Newer versions include fixes for cleanup bugs and improved artifact handling [2].


    •  
     
     

    6. Redeploy if Necessary

     

    • If cleanup consistently fails, consider:

      • Removing the environment from Lifecycle Services.

      • Cleaning up Service Fabric manually.

      • Re-deploying with updated configuration files.


    •  
     
     

    Please verify if this helps resolve the issue or if you'd like assistance with specific commands or log analysis.

     

    Thanks and best regards,\
    Daniele\
    Note: This response was prepared with support from Copilot to ensure clarity and completeness.

     

    [1]: https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/deployment/troubleshoot-on-prem\
    [2]: https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/lifecycle-services/update-local-agent\
    [3]: https://stoneridgesoftware.com/how-to-fix-a-binary-deployment-fail-in-dynamics-365-for-finance-operations/


    References
  • GM-16051639-0 Profile Picture
    8 on at
    LocalAgentCommon.LocalAgentInvalidOperationException
    Actually, I'm deploying the application package, after this I'm getting the above error when I drill down the problem.
     
    For your reference I'm attaching the pictures also.
     
     
     
  • Ramesh Kumar Profile Picture
    6,897 Super User 2025 Season 2 on at
    LocalAgentCommon.LocalAgentInvalidOperationException
    Can you please provide little more about on what application you are using and what next code/business process you are trying to solve
     
    Thanks
    Ramesh
     
    If this was helpful, please check the "Does this answer your question?" box and mark it as verified.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

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

#1
Mansi Soni Profile Picture

Mansi Soni 243 Super User 2025 Season 2

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 158 Most Valuable Professional

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 95 Super User 2025 Season 2

Product updates

Dynamics 365 release plans