Skip to content

Output command fails to parse absolute file paths #741

@tmchow

Description

@tmchow

Bug

The Output command cannot parse absolute paths. For example:

Output /tmp/demo.gif

Fails with:

  2 │ Output /tmp/demo.gif
      ^^^^^^ Expected file path after output

  2 │ Output /tmp/demo.gif
             ^^^ Invalid command: tmp

  2 │ Output /tmp/demo.gif
                  ^^^^^^^^ Invalid command: demo.gif

Relative paths work fine: Output demo.gif.

Reproduction

vhs new test.tape
vhs test.tape

The generated template includes Output /tmp/test.gif which fails immediately.

Root Cause

The lexer treats / as a regex delimiter (case '/' in lexer.go), so /tmp/demo.gif tokenizes as REGEX("tmp") + STRING("demo.gif") instead of a single path token. The parser's parseOutput() only accepts STRING tokens after Output.

Workaround

Quote the path: Output "/tmp/demo.gif"

Environment

vhs version v0.11.0 (c6af91a)
macOS 15.5

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