Skip to content

Bad error message when Nones are cast to Files with --no-quant-check #800

@ThomasHickman

Description

@ThomasHickman

If you have a workflow where Nones are cast to a File with --no-quant-check enabled, a non-user friendly stack trace is dumped to the console. For example, for the workflow:

version 1.1

workflow test_workflow {
  output {
    Array[File] result = [None]
  }
}

the output is:

$ miniwdl run --no-quant-check test.wdl
2025-08-05 15:27:04.565 wdl.w:test_workflow workflow start :: name: "test_workflow", source: "test.wdl", line: 3, column: 1, dir: "/Users/user/20250805_152704_test_workflow"
2025-08-05 15:27:04.567 wdl.w:test_workflow miniwdl :: version: "v1.12.1", uname: "Darwin F362Y7KQKP-MAC 24.5.0 Darwin Kernel Version 24.5.0: Tue Apr 22 19:54:29 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6030 arm64"
2025-08-05 15:27:04.569 wdl.w:test_workflow workflow test_workflow (test.wdl Ln 3 Col 1) failed :: dir: "/Users/user/20250805_152704_test_workflow", error: "FileNotFoundError", node: "output-result", traceback: ["Traceback (most recent call last):", "  File \"/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/runtime/workflow.py\", line 1012, in _workflow_main_loop", "    next_call = state.step(cfg, stdlib)", "                ^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/runtime/workflow.py\", line 292, in step", "    raise exn", "  File \"/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/runtime/workflow.py\", line 289, in step", "    res = self._do_job(cfg, stdlib, job)", "          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/runtime/workflow.py\", line 384, in _do_job", "    v = job.node.expr.eval(env, stdlib=stdlib).coerce(job.node.type)", "        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/Value.py\", line 222, in coerce", "    desired_type, [v.coerce(desired_type.item_type) for v in self.value], self.expr", "                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/Value.py\", line 381, in coerce", "    raise FileNotFoundError()", "FileNotFoundError"]
2025-08-05 15:27:04.570 wdl.w:test_workflow aborting workflow
2025-08-05 15:27:04.571 miniwdl-run  :: error: "FileNotFoundError", node: "output-result", traceback: ["Traceback (most recent call last):", "  File \"/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/runtime/workflow.py\", line 1012, in _workflow_main_loop", "    next_call = state.step(cfg, stdlib)", "                ^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/runtime/workflow.py\", line 292, in step", "    raise exn", "  File \"/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/runtime/workflow.py\", line 289, in step", "    res = self._do_job(cfg, stdlib, job)", "          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/runtime/workflow.py\", line 384, in _do_job", "    v = job.node.expr.eval(env, stdlib=stdlib).coerce(job.node.type)", "        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/Value.py\", line 222, in coerce", "    desired_type, [v.coerce(desired_type.item_type) for v in self.value], self.expr", "                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/Value.py\", line 381, in coerce", "    raise FileNotFoundError()", "FileNotFoundError", "", "The above exception was the direct cause of the following exception:", "", "Traceback (most recent call last):", "  File \"/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/CLI.py\", line 821, in runner", "    rundir, output_env = runtime.run(cfg, target, input_env, run_dir=run_dir, _cache=cache)", "                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/runtime/__init__.py\", line 63, in run", "    return entrypoint(cfg, exe, inputs, **run_kwargs)  # type: ignore", "           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/runtime/workflow.py\", line 934, in run_local_workflow", "    outputs = _workflow_main_loop(", "              ^^^^^^^^^^^^^^^^^^^^", "  File \"/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/runtime/workflow.py\", line 1113, in _workflow_main_loop", "    raise wrapper from exn", "WDL.runtime.error.RunFailed: workflow test_workflow (test.wdl Ln 3 Col 1) failed"], dir: "/Users/user/20250805_152704_test_workflow"

Here's what the stacktrace looks like with proper formatting:

Traceback (most recent call last):
  File "/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/runtime/workflow.py", line 1012, in _workflow_main_loop
    next_call = state.step(cfg, stdlib)
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/runtime/workflow.py", line 292, in step
    raise exn
  File "/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/runtime/workflow.py", line 289, in step
    res = self._do_job(cfg, stdlib, job)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/runtime/workflow.py", line 384, in _do_job
    v = job.node.expr.eval(env, stdlib=stdlib).coerce(job.node.type)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/Value.py", line 222, in coerce
    desired_type, [v.coerce(desired_type.item_type) for v in self.value], self.expr
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/Value.py", line 381, in coerce
    raise FileNotFoundError()
FileNotFoundError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/CLI.py", line 821, in runner
    rundir, output_env = runtime.run(cfg, target, input_env, run_dir=run_dir, _cache=cache)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/runtime/__init__.py", line 63, in run
    return entrypoint(cfg, exe, inputs, **run_kwargs)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/runtime/workflow.py", line 934, in run_local_workflow
    outputs = _workflow_main_loop(
              ^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/.local/pipx/venvs/miniwdl/lib/python3.12/site-packages/WDL/runtime/workflow.py", line 1113, in _workflow_main_loop
    raise wrapper from exn
WDL.runtime.error.RunFailed: workflow test_workflow (test.wdl Ln 3 Col 1) failed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions