# Removing jobs

Sometimes it is necessary to remove a job. For example, there could be a job that has bad data.

{% tabs %}
{% tab title="TypeScript" %}

```typescript
import { Queue } from 'bullmq';

const queue = new Queue('paint');

const job = await queue.add('wall', { color: 1 });

await job.remove();
```

{% endtab %}

{% tab title="Python" %}

```python
from bullmq import Queue

queue = Queue('paint')

job = await queue.add('wall', {'color': 1})

await job.remove()
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
Locked jobs (in active state) can not be removed. An error will be thrown.
{% endhint %}

## Having a parent job

There are 2 possible cases:

1. There are not pending dependencies; in this case the parent is moved to wait status, we may try to process this job.
2. There are pending dependencies; in this case the parent is kept in waiting-children status.

{% hint style="info" %}
Take into consideration that processed values will be kept in processed `hset` from the parent if this child is in **completed** state at the time when it's removed.
{% endhint %}

## Having pending dependencies

We may try to remove all its pending descendants first.

{% hint style="warning" %}
If any of the children are locked, the deletion process will be stopped.
{% endhint %}

### Read more:

* 💡 [Remove API Reference](https://api.docs.bullmq.io/classes/v5.Job.html#remove)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bullmq.io/guide/jobs/removing-job.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
