# Java Error Message when writing output in hail

**URL:** <https://discuss.hail.is/t/java-error-message-when-writing-output-in-hail/2391>\
**Category:** Hail Query & hailctl\
**Created:** [December 2, 2021, 8:26pm UTC](https://discuss.hail.is/t/java-error-message-when-writing-output-in-hail/2391 "2021-12-02T20:26:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![sph17](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/sph17/32/684_2.png) [@sph17](https://discuss.hail.is/u/sph17)\
**Post date:** [December 2, 2021, 8:26pm UTC](https://discuss.hail.is/t/java-error-message-when-writing-output-in-hail/2391/1 "2021-12-02T20:26:28Z")

</div>

I am trying to run a vcf filtering script with hail via Terra’s virtual environment. The configuration is attached.

 ![Screen Shot 2021-11-30 at 1.51.30 PM](https://canada1.discourse-cdn.com/flex036/uploads/hail/original/1X/8b7b3c9721b9059a4bad7e4b875d20241c4db1c4.png)

The python script that calls hail had no problem running but at the last step of writing to the output vcf location, hail throws a java error. Any suggestions would be greatly appreciated. The stdout log below:

[hail\_1202\_stdout.txt](https://discuss.hail.is/uploads/short-url/iK9i1Dco7rwgr38H8sNihoZyMlY.txt) (6.4 KB)

---

<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:** [December 2, 2021, 8:27pm UTC](https://discuss.hail.is/t/java-error-message-when-writing-output-in-hail/2391/2 "2021-12-02T20:27:54Z")

</div>

Can you post the script?

---

<div class="post-metadata">

**Author:** ![sph17](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/sph17/32/684_2.png) [@sph17](https://discuss.hail.is/u/sph17)\
**Post date:** [December 3, 2021, 3:15pm UTC](https://discuss.hail.is/t/java-error-message-when-writing-output-in-hail/2391/3 "2021-12-03T15:15:20Z")

</div>

Here is the script I’m trying to run:

> **[wgs\_pre\_processing\_vcf\_v3\_Loose\_Filters.py](https://www.dropbox.com/s/g36gyokmvbxlf4h/wgs_pre_processing_vcf_v3_Loose_Filters.py?dl=0)**
>
> Shared with Dropbox

---

<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:** [December 3, 2021, 3:18pm UTC](https://discuss.hail.is/t/java-error-message-when-writing-output-in-hail/2391/4 "2021-12-03T15:18:53Z")

</div>

How big is the VCF? This looks like it’s probably a memory error – you’re running on a pretty tiny VM. You could try increasing the size of the machine provisioned to 4 or 8 cores (which will increase the memory as well).

---

<div class="post-metadata">

**Author:** ![sph17](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/sph17/32/684_2.png) [@sph17](https://discuss.hail.is/u/sph17)\
**Post date:** [December 3, 2021, 6:31pm UTC](https://discuss.hail.is/t/java-error-message-when-writing-output-in-hail/2391/5 "2021-12-03T18:31:16Z")

</div>

Okay I will give that a shot, the VCF is only 5000 lines, I was just testing out the script. Let me give that a try!

---

<div class="post-metadata">

**Author:** ![sph17](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/sph17/32/684_2.png) [@sph17](https://discuss.hail.is/u/sph17)\
**Post date:** [December 3, 2021, 7:07pm UTC](https://discuss.hail.is/t/java-error-message-when-writing-output-in-hail/2391/6 "2021-12-03T19:07:13Z")

</div>

@tpoterba Memory increase fixed the issue if I write it locally, but the file does not exist

```auto
SparkUI available at http://saturn-282f6108-da43-4df8-95ea-903fb699127b-m.c.terra-2d3a4d00.internal:4040
Welcome to
     ____ <>__
    / /_/ / ____ / /
   / __ / _ `/ / /
  /_/ /_/\_,_/_/_/ version 0.2.62-84fa81b9ea3d
LOGGING: writing to /home/jupyter/hail-20211203-1940-0.2.62-84fa81b9ea3d.log
2021-12-03 19:41:03 Hail: INFO: Reading table without type imputation
  Loading field 'f0' as type str (user-supplied)
  Loading field 'f1' as type int32 (user-supplied)
  Loading field 'f2' as type int32 (user-supplied)
2021-12-03 19:41:03 Hail: INFO: Reading table without type imputation
  Loading field 'SampleID' as type str (not specified)
  Loading field 'FamID' as type str (not specified)
  Loading field 'Role' as type str (not specified)
2021-12-03 19:41:23 Hail: INFO: Coerced sorted dataset
2021-12-03 19:41:26 Hail: WARN: entries(): Resulting entries table is sorted by '(row_key, col_key)'.
    To preserve row-major matrix table order, first unkey columns with 'key_cols_by()'
2021-12-03 19:41:26 Hail: INFO: Reading table without type imputation
  Loading field 'FamID' as type str (not specified)
  Loading field 'TrioID' as type str (not specified)
  Loading field 'SampleID' as type str (not specified)
  Loading field 'FatherID' as type str (not specified)
  Loading field 'MotherID' as type str (not specified)
2021-12-03 19:41:27 Hail: WARN: export_vcf: ignored the following fields:
    'pheno' (column)
    'num_alleles' (row)
    'a_index' (row)
    'was_split' (row)
2021-12-03 19:41:43 Hail: INFO: Coerced sorted dataset
2021-12-03 19:41:55 Hail: INFO: Coerced sorted dataset
2021-12-03 19:42:32 Hail: INFO: Coerced sorted dataset
2021-12-03 19:42:41 Hail: INFO: Coerced sorted dataset
2021-12-03 19:42:51 Hail: INFO: Coerced sorted dataset
2021-12-03 19:43:15 Hail: INFO: Coerced sorted dataset
2021-12-03 19:43:28 Hail: INFO: Coerced sorted dataset
2021-12-03 19:43:37 Hail: INFO: Coerced sorted dataset
2021-12-03 19:44:00 Hail: INFO: Coerced sorted dataset
2021-12-03 19:44:27 Hail: INFO: Ordering unsorted dataset with network shuffle
2021-12-03 19:44:27 Hail: INFO: Ordering unsorted dataset with network shuffle
2021-12-03 19:44:44 Hail: INFO: Ordering unsorted dataset with network shuffle
2021-12-03 19:45:55 Hail: INFO: merging 1 files totalling 45.8K...
2021-12-03 19:45:55 Hail: INFO: while writing:
    mssng_db6.chr12_filter_ME_v3_loosefilters.vcf.bgz
  merge time: 131.775ms
Processing:12

```

But doesn’t exist:

```auto
jupyter@saturn-282f6108-da43-4df8-95ea-903fb699127b-m:~$ ls
hail-20211203-1859-0.2.62-84fa81b9ea3d.log notebooks
hail-20211203-1912-0.2.62-84fa81b9ea3d.log stdout.txt
hail-20211203-1931-0.2.62-84fa81b9ea3d.log wgs_pre_processing_vcf_v3_Loose_Filters.py
hail-20211203-1940-0.2.62-84fa81b9ea3d.log

```

---

<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:** [December 3, 2021, 7:49pm UTC](https://discuss.hail.is/t/java-error-message-when-writing-output-in-hail/2391/7 "2021-12-03T19:49:45Z")

</div>

I’m not sure what the default working directory is for Terra. You might try writing to an explicit full path rather than relative.

---

<div class="post-metadata">

**Author:** ![sph17](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/sph17/32/684_2.png) [@sph17](https://discuss.hail.is/u/sph17)\
**Post date:** [December 3, 2021, 8:31pm UTC](https://discuss.hail.is/t/java-error-message-when-writing-output-in-hail/2391/8 "2021-12-03T20:31:06Z")

</div>

When I tried with explicit paths either locally /home/jupyter/ or uri gs://google/bucket, I get thrown the same java error as above… Not sure what’s going on here.
