# Why won't Hangfire execute the Child-Batch?

**URL:** <https://discuss.hangfire.io/t/why-wont-hangfire-execute-the-child-batch/11386>\
**Category:** question\
**Created:** [October 10, 2025, 11:13am UTC](https://discuss.hangfire.io/t/why-wont-hangfire-execute-the-child-batch/11386 "2025-10-10T11:13:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lateralus79](https://avatars.discourse-cdn.com/v4/letter/l/3ab097/32.png) [@Lateralus79](https://discuss.hangfire.io/u/Lateralus79)\
**Post date:** [October 10, 2025, 11:13am UTC](https://discuss.hangfire.io/t/why-wont-hangfire-execute-the-child-batch/11386/1 "2025-10-10T11:13:58Z")

</div>

```auto
  public void MapEndpoint(IEndpointRouteBuilder app) {

      app.MapGet("/hangfireTest", async (NectaContext context, [FromServices] VendorCatalogHttpClient httpClient) => {
          var parentId = BatchJob.StartNew(batch =>
          {
              batch.Enqueue(HangfireQueue.Debug.Name(), () => Console.WriteLine("STARTED: Parent Job 1"));
              batch.Enqueue(HangfireQueue.Debug.Name(),() => FailingJob()); // Eror!
              batch.Enqueue(HangfireQueue.Debug.Name(), () => Console.WriteLine("STARTED: Parent Job 3"));
          }, description: "Parent-Batch");

          BatchJob.ContinueBatchWith(parentId, batch =>
          {
              batch.Enqueue(HangfireQueue.Debug.Name(), () => Console.WriteLine("STARTED: Child Batch was started!"));
              batch.Enqueue(HangfireQueue.Debug.Name(), () => Console.WriteLine("STARTED: Child Job 2"));
          }, options: BatchContinuationOptions.OnlyOnCompletedState, description:"Child-Batch");

          return Results.Ok("Batch started!");
      })
          .WithName("HangfireTest")
          .WithTags("Dummy")
          .WithOpenApi();
  }

  [AutomaticRetry(Attempts = 0)]
  public void FailingJob() {
      Console.WriteLine("ERROR: This is an error job");
      throw new Exception("Simulated Error in Parent Batch");
  }

```

the Parent job stays in state “Started”… Items “Not Finished” 1/3  
the Child job stays in state “Awaiting”…  
even without option BatchContinuationOptions.OnlyOnCompletedState!  
I just want to know why.

 ![grafik](https://europe1.discourse-cdn.com/flex017/uploads/hangfire/original/2X/b/b9063fdb0b09ca9334336bfe8bafeb71a260f6aa.png)

---

<div class="post-metadata">

**Author:** ![odinserj](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/odinserj/32/648_2.png) [@odinserj](https://discuss.hangfire.io/u/odinserj)\
**Post date:** [October 14, 2025, 5:13am UTC](https://discuss.hangfire.io/t/why-wont-hangfire-execute-the-child-batch/11386/2 "2025-10-14T05:13:36Z")

</div>

Hi, could you show me the screenshot of the non-finished background job details page to see all of its state transitions? If it’s in the Failed state, then this is by design – failed state isn’t considered to be the final one and manual intervention to re-queue/delete is required. If you’d like to ignore the exception, consider adding the following attribute to your FailingJob method:

```csharp
[AutomaticRetry(Attempts = 0, OnAttemptsExceeded = AttemptsExceededAction.Delete)]
public void FailingJob()

```

You can specify the number of automatic retries with the `Attempts` property. And once their number is exceeded, your background job will be considered as completed and an expiration time will be applied, that will lead to completion of its batch.
