bettercap/bettercap · error
can't parse string from '%s'
Error message
can't parse string from '%s'
What it means
Syntax guard in DuckyParser.parseString: a STRING/STR instruction line has no space separating the token from the payload, so there is no string argument to return — the Ducky script line is malformed.
Source
Thrown at modules/hid/duckyparser.go:59
func (p DuckyParser) parseNumber(from string) (int, error) {
idx := strings.IndexRune(from, ' ')
if idx == -1 {
return 0, fmt.Errorf("can't parse number from '%s'", from)
}
num, err := strconv.Atoi(from[idx+1:])
if err != nil {
return 0, fmt.Errorf("can't parse number from '%s': %v", from, err)
}
return num, nil
}
func (p DuckyParser) parseString(from string) (string, error) {
idx := strings.IndexRune(from, ' ')
if idx == -1 {
return "", fmt.Errorf("can't parse string from '%s'", from)
}
return from[idx+1:], nil
}
func (p DuckyParser) lineIs(line string, tokens ...string) bool {
for _, tok := range tokens {
if strings.HasPrefix(line, tok) {
return true
}
}
return false
}
func (p DuckyParser) Parse(kmap KeyMap, path string) (cmds []*Command, err error) {
lines := []string{}
source := []string{}
reader := (chan string)(nil)
View on GitHub (pinned to 8eca2820f3)
Solutions
- Put a space between STRING and the text to type, e.g. 'STRING hello world'
- Fix empty STRING lines by removing them or adding the payload
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at modules/hid/duckyparser.go:59 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of bettercap/bettercap@8eca2820f3 (2026-09-02).
Data as JSON: /api/errors/3f178d3c880d4eda.
Report an issue: GitHub.