{"record":{"id":"703d3b4717a79830","repo":"charmbracelet/vhs","slug":"literal-expects-string","errorCode":null,"errorMessage":"${literal} expects string","messagePattern":"(.+?) expects string","errorType":"validation","errorClass":"parser.Error","httpStatus":null,"severity":"error","filePath":"parser/parser.go","lineNumber":587,"sourceCode":"// parseShow parses a Show command.\n//\n//\tShow\nfunc (p *Parser) parseShow() Command {\n\tcmd := Command{Type: token.SHOW}\n\treturn cmd\n}\n\n// parseType parses a type command.\n// A type command takes a string to type.\n//\n//\tType \"string\"\nfunc (p *Parser) parseType() Command {\n\tcmd := Command{Type: token.TYPE}\n\n\tcmd.Options = p.parseSpeed()\n\n\tif p.peek.Type != token.STRING {\n\t\tp.errors = append(p.errors, NewError(p.peek, p.cur.Literal+\" expects string\"))\n\t}\n\n\tfor p.peek.Type == token.STRING {\n\t\tp.nextToken()\n\t\tcmd.Args += p.cur.Literal\n\n\t\t// If the next token is a string, add a space between them.\n\t\t// Since tokens must be separated by a whitespace, this is most likely\n\t\t// what the user intended.\n\t\t//\n\t\t// Although it is possible that there may be multiple spaces / tabs between\n\t\t// the tokens, however if the user was intending to type multiple spaces\n\t\t// they would need to use a string literal.\n\n\t\tif p.peek.Type == token.STRING {\n\t\t\tcmd.Args += \" \"\n\t\t}\n\t}","sourceCodeStart":569,"sourceCodeEnd":605,"githubUrl":"https://github.com/charmbracelet/vhs/blob/c073383b5de0b1f57bf514113029c306bc986539/parser/parser.go#L569-L605","documentation":"Fires in parseType when the token after the Type command (and optional speed option) is not a STRING, i.e. no text to type was given. The loop that concatenates string tokens never runs, so the Type command ends up with an empty Args.","triggerScenarios":"Thrown at parser/parser.go:587 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Quote the text to type, e.g. Type \"hello world\"","Move the typing speed option so it does not swallow the string, e.g. Type@100ms \"text\"","Remove the Type command if nothing should be typed"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c073383b5de0b1f57bf514113029c306bc986539","analyzedAt":"2026-09-02T01:53:05.682Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}