hibiken/asynq · error
cannot not parse option string
Error message
cannot not parse option string %q
What it means
parseOption's default branch rejects an option string it cannot recognize, returning 'cannot not parse option string %q' (note the doubled 'not', a typo in the library). Option strings must look like Name(args...) — e.g. Queue("email"), MaxRetry(5) — and anything else is invalid.
Solutions
- Fix the option string to the Name(args...) form, e.g. Queue("default") instead of Queue.
- Check for shell/config quoting that removed parentheses or quotes around arguments.
- Confirm the option name is supported by the installed asynq version.
- If passing a JSON-arg form, ensure it unmarshals to the expected shape (see the json.Unmarshal branch).
Example fix
// before
opts := []string{"MaxRetry", "Queue(email)"}
// after
opts := []string{"MaxRetry(5)", "Queue(\"email\")"} Defensive patterns
Strategy: validation
Validate before calling
if !regexp.MustCompile(`^[A-Za-z]\w*\(.*\)$`).MatchString(optStr) { return fmt.Errorf("malformed option %q", optStr) } Prevention
- Always write options as Name(args...)
- Quote option strings carefully in shell/config files
- Validate option strings at config load, before enqueue time
- Keep a canonical list of supported option names for your asynq version
When it happens
Trigger: Passing a malformed option string to asynqtooling that supports string-based options (e.g. CLI-driven enqueue); missing parentheses/args like "MaxRetry" or "Queue"; unknown option name; unparseable JSON array arg for special forms.
Common situations: Hand-written option strings in config files or CLI flags; shell quoting that stripped parentheses; copying options between library versions with different option sets.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- batch enqueue does not support group tasks
- batch enqueue does not support unique tasks
- redis connection is shared so the Inspector can't be closed…
- asynq
- asynq
AI-assisted analysis of hibiken/asynq@d135f1439b (2026-09-07).
Data as JSON: /api/errors/38246db4d74cab5f.
Report an issue: GitHub.
Appendix: source
Thrown at inspector.go:1014
if err != nil {
return nil, err
}
return ProcessIn(d), nil
case "Retention":
d, err := time.ParseDuration(arg)
if err != nil {
return nil, err
}
return Retention(d), nil
case "Header":
var h [2]string
err := json.Unmarshal([]byte(arg), &h)
if err != nil {
return nil, err
}
return Header(h[0], h[1]), nil
default:
return nil, fmt.Errorf("cannot not parse option string %q", s)
}
}
func parseOptionFunc(s string) string {
i := strings.Index(s, "(")
return s[:i]
}
func parseOptionArg(s string) string {
i := strings.Index(s, "(")
if i >= 0 {
j := strings.Index(s, ")")
if j > i {
return s[i+1 : j]
}
}
return ""
}View on GitHub (pinned to d135f1439b)