# Unable to write MT after split\_multi\_hts

**URL:** <https://discuss.hail.is/t/unable-to-write-mt-after-split-multi-hts/2781>\
**Category:** Hail Query & hailctl\
**Created:** [August 10, 2022, 8:42pm UTC](https://discuss.hail.is/t/unable-to-write-mt-after-split-multi-hts/2781 "2022-08-10T20:42:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MegL](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@MegL](https://discuss.hail.is/u/MegL)\
**Post date:** [August 10, 2022, 8:42pm UTC](https://discuss.hail.is/t/unable-to-write-mt-after-split-multi-hts/2781/1 "2022-08-10T20:42:23Z")

</div>

Hi,  
I’m encountering the following error when I try to write a matrix table to the GCS. I find this only happens after I’ve applied split\_multi\_hts as shown below (“mt\_smard\_test” writes fine, but “mt\_smard\_test2” doesn’t). Is it possible to write the matrix table after I’ve split on multi-allelic variants?  
Thanks!

mt\_smard\_test.write(f’{bucket}/data/smard1\_test.mt’)

2022-08-10 20:12:07 Hail: INFO: wrote matrix table with 26521 rows and 98590 columns in 8 partitions to []/data/smard1\_test.mt

mt\_smard\_test2 = hl.split\_multi\_hts(mt\_smard\_test)

mt\_smard\_test2.write(f’{bucket}/data/smard1\_test2.mt’)

* * *

HailUserError Traceback (most recent call last)  
/tmp/ipykernel\_118/3960666400.py in   
----\> 1 mt\_smard\_test2.write(f’{bucket}/data/smard1\_test2.mt’)

in write(self, output, overwrite, stage\_locally, \_codec\_spec, \_partitions, \_checkpoint\_file)

/opt/conda/lib/python3.7/site-packages/hail/typecheck/check.py in wrapper(\_\_original\_func, \*args, \*\*kwargs)  
575 def wrapper(_original\_func, \*args, \*\*kwargs):  
576 args, kwargs_ = check\_all(\_\_original\_func, args, kwargs, checkers, is\_method=is\_method)  
 → 577 return _original\_func(\*args, \*\*kwargs_)  
578  
579 return wrapper

/opt/conda/lib/python3.7/site-packages/hail/matrixtable.py in write(self, output, overwrite, stage\_locally, \_codec\_spec, \_partitions, \_checkpoint\_file)  
2554  
2555 writer = ir.MatrixNativeWriter(output, overwrite, stage\_locally, \_codec\_spec, \_partitions, \_partitions\_type, \_checkpoint\_file)  
 → 2556 Env.backend().execute(ir.MatrixWrite(self.\_mir, writer))  
2557  
2558 class \_Show:

/opt/conda/lib/python3.7/site-packages/hail/backend/py4j\_backend.py in execute(self, ir, timed)  
102 return (value, timings) if timed else value  
103 except FatalError as e:  
 → 104 self.\_handle\_fatal\_error\_from\_backend(e, ir)  
105  
106 async def \_async\_execute(self, ir, timed=False):

/opt/conda/lib/python3.7/site-packages/hail/backend/backend.py in \_handle\_fatal\_error\_from\_backend(self, err, ir)  
187 ‘Hail stack trace:\n’  
188 f’{better\_stack\_trace}')  
 → 189 raise HailUserError(message\_and\_trace) from None

## HailUserError: Error summary: HailException: array index out of bounds: index=2, length=2

Hail stack trace:  
File “/tmp/ipykernel\_118/1588062174.py”, line 1, in   
mt\_smard\_test2 = hl.split\_multi\_hts(mt\_smard\_test)

File “/opt/conda/lib/python3.7/site-packages/hail/methods/statgen.py”, line 2374, in split\_multi\_hts  
[hl.sum(split.AD) - split.AD[split.a\_index], split.AD[split.a\_index]])

File “/opt/conda/lib/python3.7/site-packages/hail/expr/expressions/typed\_expressions.py”, line 481, in **getitem**  
return self.\_method(“indexArray”, self.dtype.element\_type, item)

File “/opt/conda/lib/python3.7/site-packages/hail/expr/expressions/base\_expression.py”, line 695, in \_method  
x = ir.Apply(name, ret\_type, self.\_ir, \*(a.\_ir for a in args))

File “/opt/conda/lib/python3.7/site-packages/hail/ir/ir.py”, line 2263, in **init**  
self.save\_error\_info()

---

<div class="post-metadata">

**Author:** ![tpoterba](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tpoterba/32/61_2.png) [@tpoterba](https://discuss.hail.is/u/tpoterba)\
**Post date:** [August 11, 2022, 12:28am UTC](https://discuss.hail.is/t/unable-to-write-mt-after-split-multi-hts/2781/2 "2022-08-11T00:28:48Z")

</div>

Does your dataset have sex chromosomes? if so, can you share what a VCF entry looks like for a male on chrX?
