elsa-workflows / elsa-core

A .NET workflows library
https://v3.elsaworkflows.io/
MIT License
5.88k stars 1.06k forks source link

Elsa 3 error executing csharp expression - The memory block 'Elsa.Expressions.Models.MemoryBlockReference' does not exist #5264

Open rmanjusha opened 3 weeks ago

rmanjusha commented 3 weeks ago

Description

Getting error - 'The memory block 'Elsa.Expressions.Models.MemoryBlockReference' does not exist' when a accessing workflow input inside "Elsa.FlowDecision" using csharp expression "Input.Get(\"IsError\")"

Steps to Reproduce

1. Workflow uses custom activities and FlowDecision. Workflow expects input of type boolean
2. The flow is designed using designer and WorkFlow JSON is exported  and run from .Net 8 application using code below

image

Attached is the workflow json generated

elsa3.json

Please advise.

glime-ai[bot] commented 3 weeks ago

To address the issue you're encountering with the 'The memory block 'Elsa.Expressions.Models.MemoryBlockReference' does not exist' error, it's important to ensure that the workflow is correctly configured to pass and receive the expected inputs and outputs, especially when dealing with custom activities and decisions.

Here are a few steps you can take to troubleshoot and potentially resolve the issue:

  1. Check the Workflow Definition: Ensure that the workflow definition (JSON) is correctly structured and that the input for the Elsa.FlowDecision activity is correctly mapped to the expected boolean value.

  2. Review Custom Activities: If you are using custom activities, make sure that they are correctly returning the expected outputs and that these outputs are accessible to the Elsa.FlowDecision activity.

  3. Examine the Workflow Context: Verify that the workflow context at runtime contains the necessary data and that it is being passed correctly to the Elsa.FlowDecision activity.

  4. Update Elsa Packages: If you are not using the latest version of Elsa, consider updating to the latest stable release, as it may contain bug fixes and improvements that could resolve your issue.

  5. Consult Elsa Documentation: Review the official Elsa documentation for guidance on working with inputs and outputs, custom activities, and decision activities.

  6. Seek Community Help: If the issue persists, consider reaching out to the Elsa community on GitHub or other forums for assistance. Provide detailed information about your issue, including the workflow definition and any relevant code snippets.

  7. Debugging: Use debugging tools to step through the workflow execution and inspect the state of the workflow at the point where the error occurs. This can help identify any discrepancies in the data being passed to the Elsa.FlowDecision activity.

If you have already tried these steps without success, please provide additional details about the custom activities you are using and how you are passing inputs into the workflow. This information will be crucial to further diagnose and resolve the issue.

This comment was generated by Glime.

rmanjusha commented 3 weeks ago

Attached is updated workflow saving activity result to workflow variable and using that in decision . When loading the workflow json the variable count shows zero. But workflow json has variables defined. Could this be the reason for error ? @sfmskywalker Please advise.

decision-with-activity-output.json

image

image