Skip to content

WorkflowDefinition crashes when workflow has no tasks #1593

Description

@mathecruz

Creating a WorkflowDefinition from a Workflow with an empty task list causes a crash.

Steps to reproduce:

Workflow workflow = WorkflowBuilder.workflow().tasks().build();
WorkflowDefinition.of(application, workflow);

Actual behavior:

TaskExecutorHelper.createExecutorList() calls iterator.next() without checking hasNext() on the empty task map, resulting in a NoSuchElementException.

Activity

  1. fjtirado commented on Aug 4, 2026

    @fjtirado
    Collaborator

    A workflow definition must have tasks.
    Therefore a definition without task is invalid and it is ok to throw a runtime exception when it is executed.
    The safeguards should be added in the APIS that generates the wrong workflow.

  2. mathecruz commented on Aug 4, 2026

    @mathecruz
    CollaboratorAuthor

    While investigating this issue, I found two related problems:

    1. WorkflowReader.defaultReader() skips validation

    defaultReader() returns NoValidationHolder.instance instead of ValidationHolder.instance, so workflows are never validated against the schema by default. After fixing this, several tests fail
    because their YAML files aren't schema-compliant.

    2. Local schema is outdated

    types/src/main/resources/schema/workflow.yaml is out of sync with the upstream specification schema.

    Items to address:

    • Fix defaultReader() to use ValidationHolder (validate by default)
    • Sync local schema with upstream specification
    • Fix test YAML files to pass validation
    • Guard processTaskList from null/empty task lists (original issue)
  3. fjtirado commented on Aug 6, 2026

    @fjtirado
    Collaborator

    Schema and default readed has been updated. This one should be used to validate DSL

  4. added theissue type on Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions