The chdir option in sbatch doesn't expand the file patterns. For instance, this minimal test-chdir.sh #! /bin/bash #SBATCH --account ec35 #SBATCH --mem 1M #SBATCH --time 1 #SBATCH --chdir /fp/projects01/ec35/homes/%u #SBATCH --output /fp/projects01/ec35/homes/%u/test-for-chdir-%j.out touch touched-from-$SLURM_JOB_ID results in $ sbatch -vvvvv test-chdir.sh sbatch: debug3: cli_filter/lua: slurm_lua_loadscript: skipping loading Lua script: /run/slurm/conf/cli_filter.lua sbatch: debug2: Found in script, argument "--account" sbatch: debug2: Found in script, argument "ec35" sbatch: debug2: Found in script, argument "--mem" sbatch: debug2: Found in script, argument "1M" sbatch: debug2: Found in script, argument "--time" sbatch: debug2: Found in script, argument "1" sbatch: debug2: Found in script, argument "--chdir" sbatch: debug2: Found in script, argument "/fp/projects01/ec35/homes/%u" sbatch: debug2: Found in script, argument "--output" sbatch: debug2: Found in script, argument "/fp/projects01/ec35/homes/%u/test-for-chdir-%j.out" sbatch: debug3: cli_filter/lua: slurm_lua_loadscript: skipping loading Lua script: /run/slurm/conf/cli_filter.lua sbatch: defined options sbatch: -------------------- -------------------- sbatch: account : ec35 sbatch: chdir : /fp/projects01/ec35/homes/%u sbatch: mem : 1 sbatch: output : /fp/projects01/ec35/homes/%u/test-for-chdir-%j.out sbatch: time : 00:01:00 sbatch: verbose : 5 sbatch: -------------------- -------------------- sbatch: end of defined options sbatch: debug: propagating SLURM_PRIO_PROCESS=5 sbatch: debug: propagating UMASK=0022 sbatch: debug3: Trying to load plugin /usr/lib64/slurm/select_cons_res.so sbatch: select/cons_res: common_init: select/cons_res loaded sbatch: debug3: Success. sbatch: debug3: Trying to load plugin /usr/lib64/slurm/select_cray_aries.so sbatch: select/cray_aries: init: Cray/Aries node selection plugin loaded sbatch: debug3: Success. sbatch: debug3: Trying to load plugin /usr/lib64/slurm/select_cons_tres.so sbatch: select/cons_tres: common_init: select/cons_tres loaded sbatch: debug3: Success. sbatch: debug3: Trying to load plugin /usr/lib64/slurm/select_linear.so sbatch: select/linear: init: Linear node selection plugin loaded with argument 17 sbatch: debug3: Success. sbatch: debug3: Trying to load plugin /usr/lib64/slurm/auth_munge.so sbatch: debug: auth/munge: init: Munge authentication plugin loaded sbatch: debug3: Success. sbatch: debug3: cli_filter/lua: slurm_lua_loadscript: skipping loading Lua script: /run/slurm/conf/cli_filter.lua Submitted batch job 70471 sbatch: debug2: spank: private_tmp.so: exit = 0 with an error in the output $ cat test-for-chdir-70471.out Starting job 70471 on c1-28 at Sat May 7 22:13:49 CEST 2022 slurmstepd: error: couldn't chdir to `/fp/projects01/ec35/homes/%u': No such file or directory: going to /tmp instead slurmstepd: error: couldn't chdir to `/fp/projects01/ec35/homes/%u': No such file or directory: going to /tmp instead ... As you can see the user is not expanded within the --chdir option. I tested it with bash and sh, and the problem persists. Let me know if you need further testing.