Nipype pipeline error with finding the files

Hello everyone,
I have a simple pipeline that attempts to simple iterate over subjects and smoothing kernels, and smooth data

However, it keeps produced the same error when searching for the files. I have triple checked that the pathing is correct. Can someone help with identifying the error

# %%
from utils.contasts import *
from utils.nipype_helper import *


from nipype.interfaces import fsl, spm, matlab
from nipype import (
    Node,
    MapNode,
    Workflow,
    IdentityInterface,
    SelectFiles,
    DataSink,
    Function,
    config,
    logging,
)

def expand_smoothing_kernel(kernel_list):
    return [kernel_list, kernel_list, kernel_list]

def concatenate_runs(file1,file2):
    return [file1,file2]

fsl.FSLCommand.set_default_output_type(NIFTI_FORMAT)
matlab.MatlabCommand.set_default_paths(SPM_DIR)

TR = 1.17

NIPYPE_CONFIG = {
    "execution": {
        "remove_unnecessary_outputs": "true",
        "keep_inputs": "false",
        "poll_sleep_duration": "60",
        "stop_on_first_rerun": "false",
        "hash_method": "timestamp",
        "local_hash_check": "true",
        "create_report": "true",
        "crashdump_dir": PREPROC_DIR / "denoise_logs",
        "use_relative_paths": "false",
        "job_finished_timeout": "5",
    },
    "logging": {
        "workflow_level": "INFO",
        "filemanip_level": "INFO",
        "interface_level": "INFO",
        "log_directory": PREPROC_DIR / "denoise_logs",
        "log_to_file": "true",
    },
}

config.update_config(NIPYPE_CONFIG)
logging.update_logging(config)
# %%

subject_list = [
    subj_dir.name
    for subj_dir in FMRIPREP_DIR.glob("*")
    if subj_dir.is_dir() and str(subj_dir.name).startswith("sub")
]

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

# %%
templates = {
    "func_ES": "{subject_list}/ses-*/func/{subject_list}_ses-*_task-ES_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.nii.gz",
    "func_MB": "{subject_list}/ses-*/func/{subject_list}_ses-*_task-MB_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.nii.gz",
}
selectfiles = Node(SelectFiles(templates), name="selectfiles")
selectfiles.inputs.base_directory = str(FMRIPREP_DIR)

# %%
datasink = Node(DataSink(), name="datasink")
datasink.inputs.base_directory = str(PREPROC_DIR)

#%%
concatentation = Node(
    Function(
        input_names=["file1","file2"],
        output_names=["out_files"],
        function=concatenate_runs,
    ),     
    name="concatentation",
)

# %%
smoothing_kernel = Node(
    Function(
        input_names=["kernel_list"],
        output_names=["kernel_list"],
        function=expand_smoothing_kernel,
    ),
    name="smoothing_kernel",
)

# %%
smoothing = MapNode(spm.Smooth(), name="smoothing",iterfield=['in_files'])
# %%
smooth_scale_wf = Workflow(name="smooth_scale_wf")
smooth_scale_wf.base_dir = str(PREPROC_DIR)

smooth_scale_wf.connect(
    [
        (infosource, selectfiles, [("subject_list", "subject_list")]),
        (infosource, smoothing_kernel, [("kernel_list", "kernel_list")]),
        
        (selectfiles, concatentation, [("func_ES", "file1")]),
        (selectfiles, concatentation, [("func_ES", "file2")]),

        (concatentation, smoothing, [("out_files", "in_files")]),
        (smoothing_kernel, smoothing, [("kernel_list", "fwhm")]),
    ]
)

smooth_scale_wf.run()

# %%

The error I get is :



TraitError: Each element of the 'in_files' trait of a DynamicTraitedSpec instance must be a pathlike object or string representing an existing file, but a value of '/data/project/dynamic_brain_mind/Data/CRC/main/3_Neuroimaging/1_raw/BIDS_PARIS/derivatives/fmriprep/sub-006/ses-2/func/sub-006_ses-2_task-ES_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.nii.gz' <class 'str'> was specified.

Error setting node input:
Node: smoothing
input: in_files
results_file: /data/project/dynamic_brain_mind/Data/CRC/main/3_Neuroimaging/1_raw/BIDS_PARIS/derivatives/preprocess/smooth_scale_wf/_kernel_list_6_subject_list_sub-006/concatentation/result_concatentation.pklz
value: ['/data/project/dynamic_brain_mind/Data/CRC/main/3_Neuroimaging/1_raw/BIDS_PARIS/derivatives/fmriprep/sub-006/ses-2/func/sub-006_ses-2_task-ES_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.nii.gz', '/data/project/dynamic_brain_mind/Data/CRC/main/3_Neuroimaging/1_raw/BIDS_PARIS/derivatives/fmriprep/sub-006/ses-2/func/sub-006_ses-2_task-ES_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.nii.gz']

However, as I mentioned, the paths are correct and the files exist in these paths