# AssertionError: assertion failed

**URL:** <https://discuss.hail.is/t/assertionerror-assertion-failed/3644>\
**Category:** Hail Batch & General Cloud\
**Created:** [November 13, 2023, 10:29am UTC](https://discuss.hail.is/t/assertionerror-assertion-failed/3644 "2023-11-13T10:29:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![irun](https://avatars.discourse-cdn.com/v4/letter/i/bcef8e/32.png) [@irun](https://discuss.hail.is/u/irun)\
**Post date:** [November 13, 2023, 10:29am UTC](https://discuss.hail.is/t/assertionerror-assertion-failed/3644/1 "2023-11-13T10:29:12Z")

</div>

Hi!  
I am trying to generate hail indexes for the imputed bgen files in RAP (dnanexus platform) for UK Biobank data processing. The command bellow has worked fine for all the chromosomes except chromosome 4, for which I am getting the error below. What might be the issue?

Thank you very much in advance!

file\_url = f"file://{bgen\_path}/ukb22828\_c4\_b0\_v3.bgen"  
hl.index\_bgen(file\_url,  
index\_file\_map={file\_url:f"hdfs:///ukb22828\_c4\_b0\_v3.bgen.idx2"},  
contig\_recoding={“04”: “4”},  
reference\_genome=“GRCh37”,  
skip\_invalid\_loci=True)

Traceback (most recent call last): (0 + 1) / 1]  
File “”, line 1, in   
File “”, line 2, in index\_bgen  
File “/opt/conda/lib/python3.9/site-packages/hail/typecheck/check.py”, line 584, in wrapper  
return _original\_func(\*args, \*\*kwargs_)  
File “/opt/conda/lib/python3.9/site-packages/hail/methods/impex.py”, line 3014, in index\_bgen  
for r in ht.collect():  
File “”, line 2, in collect  
File “/opt/conda/lib/python3.9/site-packages/hail/typecheck/check.py”, line 584, in wrapper  
return _original\_func(\*args, \*\*kwargs_)  
File “/opt/conda/lib/python3.9/site-packages/hail/table.py”, line 2178, in collect  
return Env.backend().execute(e.\_ir, timed=\_timed)  
File “/opt/conda/lib/python3.9/site-packages/hail/backend/py4j\_backend.py”, line 82, in execute  
raise e.maybe\_user\_error(ir) from None  
File “/opt/conda/lib/python3.9/site-packages/hail/backend/py4j\_backend.py”, line 76, in execute  
result\_tuple = self.\_jbackend.executeEncode(jir, stream\_codec, timed)  
File “/cluster/spark/python/lib/py4j-0.10.9.5-src.zip/py4j/java\_gateway.py”, line 1321, in **call**  
File “/opt/conda/lib/python3.9/site-packages/hail/backend/py4j\_backend.py”, line 35, in deco  
raise fatal\_error\_from\_java\_error\_triplet(deepest, full, error\_id) from None  
hail.utils.java.FatalError: AssertionError: assertion failed

Java stack trace:  
org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 13.0 failed 4 times, most recent failure: Lost task 0.3 in stage 13.0 (TID 52) (ip-10-60-65-131.eu-west-2.compute.internal executor 0): java.lang.AssertionError: assertion failed

---

<div class="post-metadata">

**Author:** ![danking](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/danking/32/43_2.png) [@danking](https://discuss.hail.is/u/danking)\
**Post date:** [November 13, 2023, 5:37pm UTC](https://discuss.hail.is/t/assertionerror-assertion-failed/3644/2 "2023-11-13T17:37:52Z")

</div>

Hi @irun, I’m sorry Hail is failing for you. I expect this to work fine.

We nee the full and complete stack trace to diagnose. We need everything after the line “Java stack trace:”. Can you share all of that?

We will probably also need the Hail log file. You can find that in the working directory of your Python process or Jupyter Notebook.

We also need to know which version of Hail you are using. That should be included in the full and complete stack trace. If it is not, please add it!

* * *

One common cause of this error is trying to use an old version of Hail with BGEN v1.3 files. Support for BGEN v1.3 was added [in Hail 0.2.108](https://hail.is/docs/0.2/change_log.html#version-0-2-108) which was released ten months ago. Due to the small size of our team and large number of users, we cannot support old versions of Hail. We’ll need you to update to the latest version, 0.2.126, if you’re not already on the latest version.

---

<div class="post-metadata">

**Author:** ![Gaurav](https://avatars.discourse-cdn.com/v4/letter/g/b487fb/32.png) [@Gaurav](https://discuss.hail.is/u/Gaurav)\
**Post date:** [July 26, 2024, 9:30pm UTC](https://discuss.hail.is/t/assertionerror-assertion-failed/3644/3 "2024-07-26T21:30:15Z")

</div>

@irun I am facing the same issue, how did you navigate through it, My Hail version is 0.2.116, I am getting the error in the same file. Would appreciate any help
