Skip to main content

Overview

Throw WaitingChildrenError from a job processor to move the job to the waiting-children state, indicating that it’s waiting for child jobs to complete.

Class

Usage

This error is typically handled internally by BullMQ when using FlowProducer. You rarely need to throw it manually.

Behavior

When WaitingChildrenError is thrown:
  1. The job is moved from active to waiting-children state
  2. The job waits for its child jobs to complete
  3. Once all children are completed, the job moves to waiting state
  4. The parent job is then processed and can access children results

Common Use Case: FlowProducer

FlowProducer automatically handles this for parent-child jobs:

Manual Child Job Creation

You can manually create child jobs and use WaitingChildrenError:

Accessing Child Results

When children complete, the parent can access their results:

Monitoring Waiting Children

Checking Waiting Children State

Child Job Failure Handling

Control how parent jobs handle child failures:

Example: Multi-Stage Processing

When to Use WaitingChildrenError

  • When using FlowProducer (handled automatically)
  • Manual parent-child job relationships
  • Multi-stage job processing
  • Aggregating results from parallel jobs