Hello, I am running into Java heap space error at ...
# sarek
a
Hello, I am running into Java heap space error at the BaseRecalibrator step:
Copy code
[c2/bcbd5f] NFC…CALIBRATOR (OV1369_R2_P66) | 8 of 346
Plus 81 more processes waiting for tasks…
ERROR ~ Error executing process > 'NFCORE_SAREK:SAREK:BAM_BASERECALIBRATOR:GATK4_BASERECALIBRATOR (346)'

Caused by:
  Java heap space

 -- Check '.nextflow.log' file for details
ERROR ~ Execution aborted due to an unexpected error

 -- Check '.nextflow.log' file for details
ERROR ~ Execution aborted due to an unexpected error

 -- Check '.nextflow.log' file for details
ERROR ~ Pipeline failed. Please refer to troubleshooting docs: https://nf-co.re/docs/usage/troubleshooting

 -- Check '.nextflow.log' file for details
Join mismatch for the following entries: key=[patient:OV1369_R2_P66, sample:OV1369_R2_P66, sex:XX, status:1, n_fastq:12, data_type:cram, id:OV1369_R2_P66] values=


-[nf-core/sarek] Pipeline completed with errors-
WARN: Killing running tasks (4)
ERROR ~ Java heap space

 -- Check '.nextflow.log' file for details
In the c2/bcbd5f folder in work directory, I found that the Base Recalibrator step succeeded:
Copy code
17:36:52.289 INFO  FeatureManager - Using codec BEDCodec to read file file:///scratch/asmab/ovcan/work/c2/bcbd5ff98c81aedc088986b37226bc/chr11_65500120-65506481.bed
17:36:52.294 INFO  IntervalArgumentCollection - Processing 6362 bp from intervals
17:36:52.297 WARN  IndexUtils - Feature file "file:///scratch/asmab/ovcan/work/c2/bcbd5ff98c81aedc088986b37226bc/dbsnp_146.hg38.vcf.gz" appears to contain no sequence dictionary. Attempting to retrieve a sequence dictionary from the associated index file
17:36:52.463 INFO  BaseRecalibrator - Done initializing engine
17:36:52.466 INFO  BaseRecalibrationEngine - The covariates being used here: 
17:36:52.466 INFO  BaseRecalibrationEngine -    ReadGroupCovariate
17:36:52.466 INFO  BaseRecalibrationEngine -    QualityScoreCovariate
17:36:52.467 INFO  BaseRecalibrationEngine -    ContextCovariate
17:36:52.467 INFO  BaseRecalibrationEngine -    CycleCovariate
17:36:52.508 INFO  ProgressMeter - Starting traversal
17:36:52.509 INFO  ProgressMeter -        Current Locus  Elapsed Minutes       Reads Processed     Reads/Minute
17:36:53.293 INFO  BaseRecalibrator - 1 read(s) filtered by: MappingQualityNotZeroReadFilter 
0 read(s) filtered by: MappingQualityAvailableReadFilter 
0 read(s) filtered by: MappedReadFilter 
0 read(s) filtered by: NotSecondaryAlignmentReadFilter 
1447 read(s) filtered by: NotDuplicateReadFilter 
0 read(s) filtered by: PassesVendorQualityCheckReadFilter 
0 read(s) filtered by: WellformedReadFilter 
1448 total reads filtered out of 7243 reads processed
17:36:53.294 INFO  ProgressMeter -       chr11:65505405              0.0                  5795         443494.9
17:36:53.294 INFO  ProgressMeter - Traversal complete. Processed 5795 total reads in 0.0 minutes.
17:36:53.326 INFO  BaseRecalibrator - Calculating quantized quality scores...
17:36:53.335 INFO  BaseRecalibrator - Writing recalibration report...
17:36:53.622 INFO  BaseRecalibrator - ...done!
17:36:53.626 INFO  BaseRecalibrator - BaseRecalibrator was able to recalibrate 5795 reads
17:36:53.626 INFO  BaseRecalibrator - Shutting down engine
[October 8, 2025 at 5:36:53 PM GMT] org.broadinstitute.hellbender.tools.walkers.bqsr.BaseRecalibrator done. Elapsed time: 0.04 minutes.
Runtime.totalMemory()=2826960896
Has the recalibration step failed for a different region perhaps due to memory issue?
t
Yes, the error clearly says,
Caused by: Java heap space
, and different regions may have different memory requirements, so it could fail in one, but not the other. Do you know how much it is using? Heap space is controlled by the
-Xms
(initial/minimum) and
-Xmx
(maximum) Java parameters. You can look if you see those in the
.command.sh
of the process, or you can get the command used by the process from the
execution_report_*.html
(go to the process table, type some part of the process name [
GATK4_BASERECALIBRATOR
] into the search box to narrow the list, find representative line in the table, scroll right until the
script
column and click on that see the full command). While you are there, also check the total memory allocation for the job (just to be sure it got enough). If the total memory is too low or borderline, you can set that in a config with:
Copy code
process {
    withName: "GATK4_BASERECALIBRATOR" {
       memory = ??.GB  // put a reasonable number here
    }
}
Sometimes the total RAM influences what is available for the Java heap. The Java parameters can be set in the environment variable
NXF_JVM_ARGS
(but this may not be effective if the command in the process says something different), or maybe there is a process-specific way.
✅ 1