I've got this error while running bot in production: Object reference not set to an instance of an object

Hi all,
I’ve got this error while running the bot in production environment after reinstalled windows (the bot run well in dev environment with the same packages version).

Object reference not set to an instance of an object.
at lambda_method(Closure , ActivityContext )

at Microsoft.VisualBasic.Activities.VisualBasicValue1.Execute(CodeActivityContext context)

at System.Activities.CodeActivity1.InternalExecuteInResolutionContext(CodeActivityContext context)

at System.Activities.Runtime.ActivityExecutor.ExecuteInResolutionContext[T](ActivityInstance parentInstance, Activity1 expressionActivity) at System.Activities.InArgument1.TryPopulateValue(LocationEnvironment targetEnvironment, ActuvityInstance activittyInstance, ActivityExecutor executor)

at System.Activities.RuntimeArgument.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance targetActivityInstance, ActivityExecutor executor, Object argumentValueOverride, Location resultLocation, Boolean skipFastPath)

at System.Activities.ActivityInstance.InternalTryPopulateArgumentValueOrScheduleExpression(RuntimeArgument argument, Int32 nextArgumentIndex, ActivityExecutor executor, IDictionary2 argumentValueOverrides, Location resultLocation, Boolean isDynamicUpdate)

at System.Activities.ActivityInstance.ResolveArguments(ActivityExecutor executor, IDictionary2 argumentValueOverrides, Location resultLocation, Int32 startIndex)

at System.Activities.Runtime.ActivityExecutor.ExecutorActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

Hey @Ngoc_Nguyen Welcome to the UiPath Community

This error typically occurs when the bot is trying to access or use an object that hasn’t been properly initialized or assigned a value. Since it’s working in the dev environment but failing in production, there might be differences in the configuration or environment settings, such as

  1. Missing or incorrect variable assignments.
  2. Issues with package versions or dependencies after the reinstallation.
  3. Permissions or system-level differences between dev and production.

To troubleshoot:

  1. Double-check that all required variables and objects are properly initialized.
  2. Ensure that the production environment has the same setup as the dev environment, especially regarding package installations, dependencies, and system configurations.
  3. Review any logs or detailed error messages for additional clues on where the object is failing.

This should help narrow down the cause of the issue.

Thank you so much for replying me. I will follow your instruction, hope that can solve the issue.

Hello

You can insert a breakpoint where the code fails and use the “Locals”-panel to check that your variables and arguments have the expected value.
image

Regards
Soren

I don’t know where because it happends on the production environment, in the dev environment it’s working fine.

Ahh then perhaps add some Log Messages around the failing activity to close into where it excactly fails.

Regards
Soren

Hie @Ngoc_Nguyen try to run your process in debug mode… and add some log messages …
cheers

There’s no error while running in UiPath Studio (in both debug and run mode) but UiPath Assistant.

@Ngoc_Nguyen try to match the dependencies for prod to same version as the devp. might be the version are not same so they could throw the error…
and if the error is still happen show the screeshot of that error …
cheers Happy Automation

Actually, I publish it as nupkg package and move it to package folder of UiPath, then the bot will appear on Assistant. When I run it on Assistant in the Dev environment, it got the same issue. For the studio running (on dev environment), there is no issue.

The error has been resolved by editing the config file path. Thank all.

you can do two things First approach is to download the package and then change their extension from nupkg to zip then extract that package with your desired location and inside that their is a folder name content inside that content you can see your project folder … then run it might be some url or any config key giving that error… or any path …
cheers Happy Automation

Second approach is to go to orchestrator their is a log section their you can trace the logs and find the error.

cheers Happy Automation