Debugging Lemline Workflows
This guide provides techniques and best practices for debugging workflows when they don't behave as expected.
Understanding Workflow Execution
Before diving into debugging techniques, it's important to understand how Lemline executes workflows:
Workflows are parsed and validated against the schema
Nodes are constructed and linked in a graph structure
Execution progresses through nodes, evaluating expressions and performing actions
States and variables are tracked throughout execution
Errors can occur at any stage and are handled according to your error handling configuration
Follow Along
The commands below run on the SQLite setup. Run them from the setup directory. With the JAR, substitute java -jar lemline.jar for bin/lemline. Some sections use the tutorial shop; start it from the root of the Lemline source checkout:
Enabling Debug Logging
The quickest way to see what a runner does is to start it with a more verbose log level:
The --debug, --info, --warn and --error options work with every command; the default level is ERROR. At DEBUG level, the runner logs each task it enters with its input, and the workflow output.
Quarkus log properties are not read from the Lemline configuration file, which only accepts lemline.* settings. Set them as environment variables instead (or as -D system properties):
Log levels include:
ERROR: Severe issues that prevent workflow execution
WARN: Issues that don't prevent execution but might cause incorrect behavior
INFO: Normal workflow execution events
DEBUG: Detailed information for diagnosing problems
TRACE: not available in the released binaries, which are built with
DEBUGas the lowest level
Inspecting Workflow Definitions
Print the definition Lemline has stored for a workflow. Save this definition as hello.yaml and register it:
The second command prints the stored YAML. Without arguments, bin/lemline definition get lists the registered definitions and lets you pick one.
Following Workflow Execution
To follow an instance step by step, run the runner at DEBUG level (see above) and filter the logs on the instance id: every log line carries the workflow namespace, name, version and instance id. The dashboard, served through the gRPC gateway, shows instances and their lifecycle events.
Debugging Expressions
JQ expressions are a common source of workflow issues. Lemline has no command to evaluate an expression on its own: test it with the jq command-line tool against sample data, then run the workflow with --debug to see the actual input of each task.
For example, this workflow sums order lines. Save it as aggregate-order-data.yaml:
The input has no items, so .items[] fails: the instance faults with an expression error (status 400) whose title shows the input and the expression, Unable to evaluate content {"orderId":"ORD-1"} using expr [.items[] | …. With --debug, the worker log shows the task input {"orderId":"ORD-1"} just before the error.
Debugging Common Issues
Schema Validation Errors
If your workflow fails with schema validation errors:
Check the error message for specific field issues
Validate your YAML against the workflow schema
Register the file again:
lemline definition postparses each file and reports the files it cannot read:
Expression Evaluation Errors
Common expression issues include:
Path not found: Check that the referenced property exists Run the runner with
--debugto see the input of the task where the expression fails.Type errors: Ensure the data type matches the expected type
(.amount | tonumber) * 0.1Array access issues: Check array indices and iterations
# Test array access echo '{"items":[{"name":"Product"}]}' | jq '.items[0].name'
HTTP Call Problems
Debug HTTP task issues:
Run the runner with
--debugCheck request details in logs
Verify endpoint, method, and authentication
Examine response codes and bodies
Event Handling Issues
When debugging event-based tasks:
Check event broker connectivity
Verify event topic/queue names
Ensure event correlations match
Set the
com.lemline.runner.messaginglog category toDEBUG
Testing with Mocked Activities
To run workflows without calling real services, start a runner in test mode with a file of mocked activity responses. Each http rule matches a URL (a * wildcard is allowed) and a method, and returns the given body. The file can be YAML or JSON. Create mocks.json with a rule for the shop's stock:
Stop the running worker with Ctrl+C, start it in test mode, then run a workflow that reads the stock. Save the workflow as check-stock.yaml:
From a second terminal:
The instance completes with the mocked body, {"sku":"SKU-1","available":0,"reserved":0}, while the real shop still has 100 units. A mocked call never reaches the shop. Mocked HTTP responses are returned whatever their status; use response.error to make a mocked call fail. Restart the worker without --mock-config when you are done.
Messages That Could Not Be Processed
With a shared broker, messages that a runner receives for a namespace it does not serve are parked in the failures table. Once the right runner is deployed, re-send them:
On the SQLite setup nothing is parked: the message waits in the queue until a worker serving its namespace starts, and failures replay --dry-run answers No failures found with reason 'foreign_namespace'.
Debugging Timeouts and Performance
To troubleshoot performance issues:
Read the runner metrics at
http://<host>:8080/q/metrics(message processing counts, failures and durations per channel)Look for instances that stay pending in the dashboard
Remember that only
listentask timeouts are enforced; HTTP calls use fixed limits (15 seconds to connect, 30 seconds per request)
To see the request limit, this workflow asks the shop to wait before answering. If the worker still runs with --mock-config, stop it with Ctrl+C and start it again without that option:
Save the workflow as slow-http-call.yaml:
The first instance returns the stock after one second. The second faults after 30 seconds, before the shop answers, with a communication error titled Socket timeout has expired [url=http://127.0.0.1:8787/stock?delayMs=40000, socket_timeout=30000] ms. Stop the shop when you are done:
Best Practices
Start simple: Begin with minimal workflows and add complexity gradually
Test in isolation: Debug individual tasks before combining them
Use meaningful task names: Clear naming makes debugging easier
Add diagnostic tasks: Insert logging tasks at key points
Check data shapes: Verify the structure of your data at each step
Review error handling: Ensure proper try/catch blocks are in place
Use mock services: Test with predictable external services first