-
Notifications
You must be signed in to change notification settings - Fork 634
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Courtesy of @ericblanc20
Snakemake version
9.16.3
Describe the bug
when calling shell() inside a run directive, snakemake crashes with a TypeError in the logger, at least in slurm + localrule contexts.
Logs
--- Logging error ---
[Thu Mar 12 09:20:37 2026]
Finished jobid: 4 (Rule: link_out_3)
Traceback (most recent call last):
File "[...]/snake9/lib/python3.12/logging/__init__.py", line 1163, in emit
stream.write(msg + self.terminator)
~~~~^~~~~~~~~~~~~~~~~
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
Call stack:
File "[...]/snake9/lib/python3.12/threading.py", line 1032, in _bootstrap
self._bootstrap_inner()
File "[...]/snake9/lib/python3.12/threading.py", line 1075, in _bootstrap_inner
self.run()
File "[...]/snake9/lib/python3.12/threading.py", line 1012, in run
self._target(*self._args, **self._kwargs)
File "[...]/snake9/lib/python3.12/concurrent/futures/thread.py", line 93, in _worker
work_item.run()
File "[...]/snake9/lib/python3.12/concurrent/futures/thread.py", line 59, in run
result = self.fn(*self.args, **self.kwargs)
File "[...]/snake9/lib/python3.12/site-packages/snakemake/executors/local.py", line 236, in cached_or_run
self.workflow.async_run(self.acached_or_run(job, run_func, *args))
File "[...]/snake9/lib/python3.12/site-packages/snakemake/workflow.py", line 267, in async_run
return runner.run(coro)
File "[...]/snake9/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
File "[...]/snake9/lib/python3.12/asyncio/base_events.py", line 678, in run_until_complete
self.run_forever()
File "[...]/snake9/lib/python3.12/asyncio/base_events.py", line 645, in run_forever
self._run_once()
File "[...]/snake9/lib/python3.12/asyncio/base_events.py", line 1999, in _run_once
handle._run()
File "[...]/snake9/lib/python3.12/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "[...]/snake9/lib/python3.12/site-packages/snakemake/executors/local.py", line 249, in acached_or_run
run_func(*args)
File "[...]/snake9/lib/python3.12/site-packages/snakemake/executors/local.py", line 430, in run_wrapper
run(
File "[...]/slurm-log-test/Snakefile", line 76, in __rule_link_out_2
File "[...]/snake9/lib/python3.12/site-packages/snakemake/shell.py", line 198, in __new__
logger.info(None, extra=dict(event=LogEvent.SHELLCMD, cmd=cmd))
Message: None
Arguments: ()
Minimal example
localrules:
link_out_1, link_out_2, link_out_3, link_out_4
rule all:
input:
"test/linked_1.out",
"test/linked_2.out",
"test/linked_3.out",
"test/linked_4.out",
rule create_file:
output:
"test/file.txt"
log:
"test/file.log"
shell:
r"""echo "zozo" > {output}"""
rule link_out_1:
input:
"test/file.txt"
output:
"test/linked_1.out"
run:
shell("ln -rs {input} {output}")
rule link_out_2:
input:
"test/file.txt"
output:
"test/linked_2.out"
log:
"test/linked_2.log"
run:
shell("ln -rs {input} {output}")
rule link_out_3:
input:
"test/file.txt"
output:
"test/linked_3.out"
shell:
r"""ln -rs {input} {output}"""
rule link_out_4:
input:
"test/file.txt"
output:
"test/linked_4.out"
run:
import os
os.symlink(os.path.basename(input[0]), output[0])
Additional context
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working