Lemline documentation Help

Error Reference

This reference documents the standard error types and error handling capabilities in Lemline.

Standard Error Types

Lemline implements the standardized error types defined in the Open Workflow Specification, with the base URI https://open-workflow-specification.org/spec/1.0.0/errors/:

Error Type

URI

Default Status

Description

Configuration

https://open-workflow-specification.org/spec/1.0.0/errors/configuration

400

Errors in workflow definition or structure

Validation

https://open-workflow-specification.org/spec/1.0.0/errors/validation

400

Input/output data schema validation failures

Expression

https://open-workflow-specification.org/spec/1.0.0/errors/expression

400

Expression evaluation errors (JQ syntax or execution)

Authentication

https://open-workflow-specification.org/spec/1.0.0/errors/authentication

401

Authentication failures

Authorization

https://open-workflow-specification.org/spec/1.0.0/errors/authorization

403

Authorization/permission failures

Timeout

https://open-workflow-specification.org/spec/1.0.0/errors/timeout

408

Timeout violations (workflow or task)

Communication

https://open-workflow-specification.org/spec/1.0.0/errors/communication

500

Errors communicating with external services

Runtime

https://open-workflow-specification.org/spec/1.0.0/errors/runtime

500

General runtime execution errors

Error Structure

All errors in Lemline follow the RFC 7807 Problem Details format:

{ "type": "https://open-workflow-specification.org/spec/1.0.0/errors/validation", "status": 400, "instance": "/do/0/validateInput", "title": "Input Validation Failed", "detail": "The 'amount' field must be a positive number" }

Field

Required

Description

type

Yes

URI reference identifying the problem type

status

Yes

HTTP status code (numeric) corresponding to the error

instance

Yes

JSON pointer to the location in the workflow where the error occurred

title

No

Short, human-readable summary of the problem

detail

No

Detailed explanation specific to this error occurrence

Error Titles and Details

Lemline errors carry no numeric or symbolic error code: identify them by type (and status), and read title and detail for the specific cause. For example:

Situation

type

status

Example message

A declared secret is not set on the runner

authorization

403

Required secret 'API_KEY' is unavailable

An HTTP call returns a non-2xx status

communication

the HTTP status (for example 404)

HTTP 404: <response body>

An HTTP call gets no response (unknown host, refused connection, timeout)

communication

500

Unable to reach https://api.example.com: unresolved host

An A2A call gets a non-2xx status from the agent

communication (see below)

the HTTP status

title A2A message/send failed, detail HTTP 503: <response body>

An A2A call gets no usable answer (unreachable agent, timeout, stream cut before its final result)

communication (see below)

500

title A2A message/send failed, detail Unable to reach https://agent.example.com: ...

A listen task reaches its timeout

timeout

408

Listen task timed out at ...

An expression fails to evaluate

expression

400

the evaluation error message

Input or output does not match its schema

validation

400

the schema validation message

A failed HTTP call can therefore be caught by type and by status, for example catch.errors.with: { type: https://open-workflow-specification.org/spec/1.0.0/errors/communication, status: 503 }. The Unable to reach title names the server only, never the path or the query of the URL.

Errors raised by call: a2a use the base URI https://serverlessworkflow.io/spec/1.0.0/errors/ instead: catch https://serverlessworkflow.io/spec/1.0.0/errors/communication for the failures above, and https://serverlessworkflow.io/spec/1.0.0/errors/runtime for the others, such as an error returned by the agent in its JSON-RPC answer.

Lemline only raises timeout errors for listen tasks: workflow-level timeouts and timeouts on other tasks are not enforced yet.

CLI Exit Codes

Exit Code

Description

0

Success

1

Error while running the command (including a missing configuration file)

2

Invalid command line (unknown option, missing argument)

Gateway API Errors

The gateway exposes gRPC (and Connect) APIs. Failed calls return standard gRPC status codes, for example INVALID_ARGUMENT for an invalid request, NOT_FOUND for an unknown definition or instance, ALREADY_EXISTS, UNAUTHENTICATED, PERMISSION_DENIED and INTERNAL.

Java Exception Hierarchy

For developers working on Lemline, workflow errors are carried by a single exception type:

java.lang.RuntimeException └── com.lemline.core.errors.WorkflowException (sealed) └── com.lemline.core.errors.InternalException

An activity reports a failed exchange with an external service by throwing com.lemline.core.errors.CommunicationException, which carries the status to report; it becomes a communication error. Any other exception thrown by an activity becomes a runtime error with status 500.

InternalException holds an InternalException.Error with the standard error fields (type, status, instance, title, detail). The error type is one of the values of com.lemline.core.errors.WorkflowErrorType (configuration, validation, expression, authentication, authorization, timeout, communication, runtime).

Defining Custom Errors

Custom error types can be defined in workflow definitions:

document: dsl: '1.0.3' namespace: examples name: typed-error version: '1.0.0' use: errors: invalidOrder: type: https://errors.example.com/invalid-order status: 422 title: Invalid order do: - validateOrder: if: ${ (.orderId // "") == "" } raise: error: invalidOrder - acceptOrder: set: status: accepted

Error Handling Examples

Basic Try-Catch

document: dsl: 1.0.3 namespace: examples name: basic-try-catch version: 1.0.0 do: - secureOperation: try: - riskyTask: listen: to: one: with: type: com.example.payment.received timeout: after: seconds: 5 catch: errors: with: type: https://open-workflow-specification.org/spec/1.0.0/errors/timeout as: timeoutError do: - handleTimeout: set: processed: false reason: ${ $timeoutError.title }

Matching Multiple Error Types

A try task has a single catch. To handle several errors differently, catch them and route on the fields of the caught error in catch.do:

document: dsl: '1.0.3' namespace: examples name: matching-multiple-error-types version: '1.0.0' do: - callService: try: - request: call: http with: method: get endpoint: http://127.0.0.1:8787/products query: fail: ${ .failStatus | tostring } catch: as: error do: - routeByStatus: switch: - rateLimited: when: ${ $error.status == 429 } then: handleRateLimit - unavailable: when: ${ $error.status == 503 } then: handleUnavailable - default: then: handleOtherError - handleRateLimit: set: outcome: rate-limited then: exit - handleUnavailable: set: outcome: unavailable then: exit - handleOtherError: set: outcome: failed errorType: ${ $error.type }

Using Retry Policies

document: dsl: 1.0.3 namespace: examples name: using-retry-policies version: 1.0.0 do: - readStock: try: - operation: call: http with: method: get endpoint: http://127.0.0.1:8787/stock query: fail: '503' failTimes: '1' key: ${ $workflow.id } catch: retry: delay: seconds: 1 backoff: exponential: {} limit: attempt: count: 3 when: ${ $error.status >= 500 }

Error Debugging

When debugging errors:

  • Read the workflow.faulted and task.faulted lifecycle events of the instance in the dashboard; they carry the error type, status, title, instance (position in the workflow) and detail.

  • Run the runner with --debug to log the input of each task. Every log line carries the workflow namespace, name, version and instance id, so you can filter on the instance.

Error Handling Best Practices

  1. Be specific with error types: Catch specific error types rather than all errors

  2. Provide fallbacks: Use default values or alternative paths for common errors

  3. Use conditional retries: Only retry errors that have a chance of succeeding on retry

  4. Include context in errors: Use descriptive error messages with relevant details

  5. Log error details: Log sufficient context for debugging

  6. Use appropriate error status codes: Match HTTP status codes to semantics

  7. Define custom error types: Create domain-specific error types for your application

  8. Organize errors hierarchically: Use consistent type URIs that reflect hierarchy

Run the Examples

Every example on this page is a complete workflow. Complete the SQLite setup, save each example under the file name used below, and run the commands from the setup directory. With the JAR, substitute java -jar lemline.jar for bin/lemline.

Start the tutorial shop from the root of the Lemline source checkout:

docker compose -f examples/tutorial-services/compose.yaml up -d

Keep the setup worker running and use a second terminal in the setup directory.

bin/lemline definition post -f typed-error.yaml bin/lemline instance start examples typed-error bin/lemline definition post -f basic-try-catch.yaml bin/lemline instance start examples basic-try-catch bin/lemline definition post -f matching-multiple-error-types.yaml bin/lemline instance start examples matching-multiple-error-types --input '{"failStatus":429}' bin/lemline instance start examples matching-multiple-error-types --input '{"failStatus":503}' bin/lemline instance start examples matching-multiple-error-types --input '{"failStatus":404}' bin/lemline definition post -f using-retry-policies.yaml bin/lemline instance start examples using-retry-policies

Example

Expected result

typed-error

Faults with invalid-order, status 422

basic-try-catch

After 5 to 15 seconds, {"processed":false,"reason":"Listen task timed out"}

matching-multiple-error-types

{"outcome":"rate-limited"}, {"outcome":"unavailable"}, then {"outcome":"failed"} with the communication error type

using-retry-policies

The stock after one retry: the HTTP 503 has status 503, so when holds

Stop the shop when you are done:

docker compose -f examples/tutorial-services/compose.yaml down
25 November 2026