Skip to content

Wrong error line numbers reported in version 8.0.1 #2574

@ghost

Description

Snakemake version 8.0.1

Describe the bug
As described in this issue, Snakemake reports incorrect line numbers for errors.

Minimal example

  1. Create the following "Snakefile":
rule all:
    input:
        "complete"

rule start:
    output:
        "complete"
    params:
        a = 1    # Edit - this syntax error (the missing comma) is deliberate, generating the erroneous line number in the error message.
        b = 2
    shell:
        "touch complete"
  1. run snakemake --cores 1

This generates the error:
SyntaxError in file [path]/Snakefile, line 20: invalid syntax. Perhaps you forgot a comma? (Snakefile, line 20)

It is the fact that the error message states "line 20" rather than "line 9" or "line 10" that is the issue I am pointing out.

The file is only 12 lines long and the SyntaxError actually occurs on line 9/10 with the deliberately introduced "forgotten" comma, which is meant to generate the SyntaxError for illustrative purposes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions