charmbracelet/vhs · error · parser.Error

expected boolean value.

Error message

expected boolean value.

What it means

Fires in parseSet when the value given for the CursorBlink setting is not a BOOLEAN token. The parser only accepts true or false; any other literal (e.g. 1, yes, on) triggers the error while the value is still stored in cmd.Args.

Source

Thrown at parser/parser.go:523

			if err != nil || len(marginFill) != 7 {
				p.errors = append(
					p.errors,
					NewError(
						p.cur,
						"\""+marginFill+"\" is not a valid color.",
					),
				)
			}
		}
	case token.CURSOR_BLINK:
		cmd.Args = p.peek.Literal
		p.nextToken()

		if p.cur.Type != token.BOOLEAN {
			p.errors = append(
				p.errors,
				NewError(p.cur, "expected boolean value."),
			)
		}

	default:
		cmd.Args = p.peek.Literal
		p.nextToken()
	}

	return cmd
}

// parseSleep parses a sleep command.
// A sleep command takes a time for how long to sleep.
//
//	Sleep <time>
func (p *Parser) parseSleep() Command {
	cmd := Command{Type: token.SLEEP}
	cmd.Args = p.parseTime()

View on GitHub (pinned to c073383b5d)

Solutions

  1. Use true or false, e.g. Set CursorBlink false
  2. Replace numeric or textual truthy values like 1 or yes with true/false
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at parser/parser.go:523 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/bea91675adc8ad65. Report an issue: GitHub.