charmbracelet/vhs · error · parser.Error

${literal} expects one string

Error message

${literal} expects one string

What it means

Fires in parseRequire when the token after the Require command is not a STRING, meaning no file path to require was supplied. The command is still built with whatever token was found and the error is recorded; Require continues with a garbage/empty argument.

Source

Thrown at parser/parser.go:560

	return cmd
}

// parseHide parses a Hide command.
//
//	Hide
func (p *Parser) parseHide() Command {
	cmd := Command{Type: token.HIDE}
	return cmd
}

// parseRequire parses a Require command.
//
//	Require
func (p *Parser) parseRequire() Command {
	cmd := Command{Type: token.REQUIRE}

	if p.peek.Type != token.STRING {
		p.errors = append(p.errors, NewError(p.peek, p.cur.Literal+" expects one string"))
	}

	cmd.Args = p.peek.Literal
	p.nextToken()

	return cmd
}

// parseShow parses a Show command.
//
//	Show
func (p *Parser) parseShow() Command {
	cmd := Command{Type: token.SHOW}
	return cmd
}

// parseType parses a type command.
// A type command takes a string to type.

View on GitHub (pinned to c073383b5d)

Solutions

  1. Pass exactly one quoted or plain string path after Require, e.g. Require vars.tape
  2. Check that the path was not accidentally consumed by the previous line or split across lines
  3. Remove the Require line if nothing needs to be required
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at parser/parser.go:560 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of charmbracelet/vhs@c073383b5d (2026-09-02). Data as JSON: /api/errors/a9f73f331b01da39. Report an issue: GitHub.