charmbracelet/vhs · error · parser.Error
"${marginFill}" is not a valid color.
Error message
"${marginFill}" is not a valid color. What it means
Fires in parseSet when the MarginFill value starts with '#' but is not a valid hex color: strconv.ParseUint of the hex digits fails or the string is not exactly 7 characters (#RRGGBB). Values not starting with '#' (named colors) skip this check entirely.
Source
Thrown at parser/parser.go:511
NewError(p.cur, windowBar+" is not a valid bar style."),
)
}
case token.MARGIN_FILL:
cmd.Args = p.peek.Literal
p.nextToken()
marginFill := p.cur.Literal
// Check if margin color is a valid hex string
if strings.HasPrefix(marginFill, "#") {
_, err := strconv.ParseUint(marginFill[1:], 16, 64)
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()View on GitHub (pinned to c073383b5d)
Solutions
- Use a full 6-digit hex color, e.g. #1D2B53 (7 chars including the #)
- Remove stray characters after the hex digits
- Use a named color string without '#' if supported
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at parser/parser.go:511 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/c0cb60ca82f72fa6.
Report an issue: GitHub.