Skip to content

Failed to retrieve memory block with reference #6874

@shouha85

Description

@shouha85

Pass a variable to workflow definition using "https://localhost:6177/elsa/api/workflow-definitions/{definitionId}/execute"

i have got the below error after executing the below steps
1- start new workflow instance with variable send like below
curl -X 'POST'
'https://localhost:6177/elsa/api/workflow-definitions/9f5970cb1fb4275c/execute'
-H 'accept: application/json'
-H 'Authorization: Bearer eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJodHRwOi8vZWxzYS5hcGkiLCJpc3MiOiJodHRwOi8vZWxzYS5hcGkiLCJleHAiOjE3NTYwMzAyMDYsImlhdCI6MTc1NjAyNjYwNiwibmFtZSI6ImFkbWluIiwicGVybWlzc2lvbnMiOiIqIiwicm9sZSI6ImFkbWluIiwibmJmIjoxNzU2MDI2NjA2fQ.Ls4K4DuHELlwW1dG8R4iEBw22_0iEH1BCnUycVzDYZg'
-H 'Content-Type: application/json'
-d '{

"versionOptions": "1",
"variables": {
"OrderId": "12345"
}
}'

2- view the created instace in elsa studio or call "https://localhost:6177/elsa/api/workflow-instances/2bd2d45bb13c3069/variables"

3- the memory block error appear

Note:

  • the work flow just have start and console and end activities
  • it has OrderId variable declared from string type
  • the workflow json is provided at the end

Error Message :
System.Exception: Failed to retrieve memory block with reference e099eb53a29524e4 at Elsa.Expressions.Models.ExpressionExecutionContext.GetBlock(MemoryBlockReference blockReference) at Elsa.Expressions.Models.ExpressionExecutionContext.Get(MemoryBlockReference blockReference) at Elsa.Expressions.Models.MemoryBlockReference.Get(ExpressionExecutionContext context) at Elsa.Workflows.DefaultWorkflowInstanceVariableReader.GetVariables(WorkflowExecutionContext workflowExecutionContext, IEnumerable1 excludeTags, CancellationToken cancellationToken) at Elsa.Workflows.Management.Services.WorkflowInstanceVariableManager.GetVariablesAsync(String workflowInstanceId, IEnumerable1 excludeTags, CancellationToken cancellationToken) at Open.Linq.AsyncExtensions.Extensions.ToList[TSource](Task1 source) at Elsa.Workflows.Api.Endpoints.WorkflowInstances.Variables.List.List.HandleAsync(CancellationToken cancellationToken) at FastEndpoints.Endpoint2.ExecAsync(CancellationToken ct) at FastEndpoints.Endpoint2.ExecAsync(CancellationToken ct) at NSwag.AspNetCore.Middlewares.SwaggerUiIndexMiddleware.Invoke(HttpContext context) at NSwag.AspNetCore.Middlewares.RedirectToIndexMiddleware.Invoke(HttpContext context) at NSwag.AspNetCore.Middlewares.OpenApiDocumentMiddleware.Invoke(HttpContext context) at Elsa.Http.Middleware.HttpWorkflowsMiddleware.InvokeAsync(HttpContext httpContext, IServiceProvider serviceProvider) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

workflow json
{"$schema":"https://elsaworkflows.io/schemas/workflow-definition/v3.0.0/schema.json","id":"50027acbffde7031","definitionId":"9f5970cb1fb4275c","name":"Workflow 4","createdAt":"2025-08-24T09:36:25.6312755\u002B00:00","version":1,"toolVersion":"3.5.0.0","variables":[{"id":"712a872a8da8ad47","name":"OrderId","typeName":"String","isArray":false,"storageDriverTypeName":"Elsa.Workflows.WorkflowInstanceStorageDriver, Elsa.Workflows.Core"}],"inputs":[],"outputs":[],"outcomes":[],"customProperties":{},"isReadonly":false,"isSystem":false,"isLatest":true,"isPublished":true,"options":{"autoUpdateConsumingWorkflows":false},"root":{"id":"71415ed7cafea98b","nodeId":"Workflow1:71415ed7cafea98b","name":"Flowchart1","type":"Elsa.Flowchart","version":1,"customProperties":{"notFoundConnections":[],"canStartWorkflow":false,"runAsynchronously":false},"metadata":{},"activities":[{"id":"f860ae7c98e03b1f","nodeId":"Workflow1:71415ed7cafea98b:f860ae7c98e03b1f","name":"Start1","type":"Elsa.Start","version":1,"customProperties":{"canStartWorkflow":false,"runAsynchronously":false},"metadata":{"designer":{"position":{"x":-254.20001220703125,"y":-111.10000610351562},"size":{"width":122.25,"height":67.57500457763672}}}},{"id":"b645771dc36929ac","nodeId":"Workflow1:71415ed7cafea98b:b645771dc36929ac","name":"End1","type":"Elsa.End","version":1,"customProperties":{"canStartWorkflow":false,"runAsynchronously":false},"metadata":{"designer":{"position":{"x":230.79998779296875,"y":-111.10000610351562},"size":{"width":114.92500305175781,"height":67.57500457763672}}}},{"text":null,"id":"f9c4e9a562105073","nodeId":"Workflow1:71415ed7cafea98b:f9c4e9a562105073","name":"WriteLine1","type":"Elsa.WriteLine","version":1,"customProperties":{"canStartWorkflow":false,"runAsynchronously":false},"metadata":{"designer":{"position":{"x":-51.20001220703125,"y":-111.10000610351562},"size":{"width":159.22500610351562,"height":67.57500457763672}}}}],"variables":[],"connections":[{"source":{"activity":"f860ae7c98e03b1f","port":"Done"},"target":{"activity":"f9c4e9a562105073","port":"In"},"vertices":[]},{"source":{"activity":"f9c4e9a562105073","port":"Done"},"target":{"activity":"b645771dc36929ac","port":"In"},"vertices":[]}]}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions