Afni in nipype shows 5d data

Hello everyone, I have the following pipeline.

# %%
infosource = Node(IdentityInterface(fields=["subject_list"]), name="infosource")
infosource.iterables = [("subject_list", subject_list)]

templates = {
    "mask": "{subject_list}/func/{subject_list}_task-gonogo_run-{run_list}_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz",
    "func": "{subject_list}/func/{subject_list}_task-gonogo_run-{run_list}_*_desc-smooth+preproc_bold.nii.gz",
    "confounds": "{subject_list}/func/{subject_list}_task-gonogo_run-{run_list}_desc-confounds_timeseries.tsv",
}
selectfiles = MapNode(
    SelectFiles(templates), name="selectfiles", iterfield=["run_list"]
)
selectfiles.inputs.base_directory = res_dir
selectfiles.inputs.run_list = run_list

sink = Node(DataSink(), name="sink")
sink.inputs.base_directory = str(res_dir)

# %%
desmat = MapNode(
    Function(
        input_names=["confounds", "res_dir", "gs"],
        output_names=["confound_txt"],
        function=filter_confound_file,
    ),
    name="desmat",
    iterfield=["confounds"],
)
desmat.inputs.res_dir = res_dir
desmat.inputs.gs = False


glm = MapNode(GLM(), name="glm", iterfield=["design", "in_file", "mask"])
glm.inputs.out_res_name = "glm_residuals.nii"
glm.inputs.out_file = "glm.nii"
glm.inputs.output_type = "NIFTI"
glm.inputs.demean = False

# Bandpass Filtering
bpf = MapNode(Bandpass(), name="bpf", iterfield=["in_file"])
bpf.inputs.lowpass = 0.09
bpf.inputs.highpass = 0.008
bpf.inputs.tr = TR
bpf.inputs.out_file = "bpf_filt"

# %%
den_workflow = Workflow(name="den_workflow")
den_workflow.base_dir = str(res_dir)
den_workflow.connect(infosource, "subject_list", selectfiles, "subject_list")

den_workflow.connect(selectfiles, "confounds", desmat, "confounds")

den_workflow.connect(selectfiles, "func", glm, "in_file")
den_workflow.connect(selectfiles, "mask", glm, "mask")
den_workflow.connect(desmat, "confound_txt", glm, "design")

den_workflow.connect(glm, "out_res", bpf, "in_file")

den_workflow.connect(glm, "out_res", sink, "glm.@out_res")
den_workflow.connect(glm, "out_file", sink, "glm.@out_file")
den_workflow.connect(bpf, "out_file", sink, "bpf.@bpf_filt")

For every of the four runs that I feed in the pipeline, I get the following error

240412-23:42:27,757 nipype.workflow ERROR:
	 Node _bpf3 failed to run on host kronos.
240412-23:42:27,758 nipype.workflow ERROR:
	 Saving crash info to /home/boulakispar/Documents/GitLab/mb_monash/crash-20240412-234227-boulakispar-_bpf3-c04f129a-925a-460f-8f10-6425b1b80c0c.pklz
Traceback (most recent call last):
  File "/home/boulakispar/miniforge3/envs/mb_monash/lib/python3.10/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/home/boulakispar/miniforge3/envs/mb_monash/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/home/boulakispar/miniforge3/envs/mb_monash/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/home/boulakispar/miniforge3/envs/mb_monash/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node _bpf3.

Cmdline:
	3dBandpass -prefix bpf_filt -dt 1.560000 0.008000 0.090000 /data/project/mb_monash/res/preproc/den_workflow/_subject_list_sub-205/bpf/mapflow/_bpf3/glm_residuals.nii
Stdout:

Stderr:
	++ 3dBandpass: AFNI version=AFNI_23.1.10 (Jul  8 2023) [64-bit]
	++ Authored by: RW Cox
	*+ WARNING: (-: For most purposes, 3dTproject is superior to 3dBandpass :-)
	*+ WARNING: (-: Even better is to use afni_proc.py for pre-processing!! :-)
	** AFNI can't deal with 5 dimensional NIfTI(/data/project/mb_monash/res/preproc/den_workflow/_subject_list_sub-205/bpf/mapflow/_bpf3/glm_residuals.nii)
	** FATAL ERROR: Can't open dataset '/data/project/mb_monash/res/preproc/den_workflow/_subject_list_sub-205/bpf/mapflow/_bpf3/glm_residuals.nii'
	** Program compile date = Jul  8 2023
Traceback:
	Traceback (most recent call last):
	  File "/home/boulakispar/miniforge3/envs/mb_monash/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 453, in aggregate_outputs
	    setattr(outputs, key, val)
	  File "/home/boulakispar/miniforge3/envs/mb_monash/lib/python3.10/site-packages/nipype/interfaces/base/traits_extension.py", line 330, in validate
	    value = super(File, self).validate(objekt, name, value, return_pathlike=True)
	  File "/home/boulakispar/miniforge3/envs/mb_monash/lib/python3.10/site-packages/nipype/interfaces/base/traits_extension.py", line 135, in validate
	    self.error(objekt, name, str(value))
	  File "/home/boulakispar/miniforge3/envs/mb_monash/lib/python3.10/site-packages/traits/base_trait_handler.py", line 74, in error
	    raise TraitError(
	traits.trait_errors.TraitError: The 'out_file' trait of an AFNICommandOutputSpec instance must be a pathlike object or string representing an existing file, but a value of '/data/project/mb_monash/res/preproc/den_workflow/_subject_list_sub-205/bpf/mapflow/_bpf3/bpf_filt+orig.BRIK' <class 'str'> was specified.

	During handling of the above exception, another exception occurred:

	Traceback (most recent call last):
	  File "/home/boulakispar/miniforge3/envs/mb_monash/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 400, in run
	    outputs = self.aggregate_outputs(runtime)
	  File "/home/boulakispar/miniforge3/envs/mb_monash/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 460, in aggregate_outputs
	    raise FileNotFoundError(msg)
	FileNotFoundError: No such file or directory '/data/project/mb_monash/res/preproc/den_workflow/_subject_list_sub-205/bpf/mapflow/_bpf3/bpf_filt+orig.BRIK' for output 'out_file' of a Bandpass interface

It runs correctly until the bandpass step, upon when I get this pathing error that tracks to afni seeing my data as 5d. However, I checked the dimension of my data, and its a standard 4D BOLD img. Can someone tell me where I make the mistake ?