{"record":{"id":"38246db4d74cab5f","repo":"hibiken/asynq","slug":"cannot-not-parse-option-string-q","errorCode":null,"errorMessage":"cannot not parse option string %q","messagePattern":"cannot not parse option string %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"inspector.go","lineNumber":1014,"sourceCode":"\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn ProcessIn(d), nil\n\tcase \"Retention\":\n\t\td, err := time.ParseDuration(arg)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn Retention(d), nil\n\tcase \"Header\":\n\t\tvar h [2]string\n\t\terr := json.Unmarshal([]byte(arg), &h)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn Header(h[0], h[1]), nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"cannot not parse option string %q\", s)\n\t}\n}\n\nfunc parseOptionFunc(s string) string {\n\ti := strings.Index(s, \"(\")\n\treturn s[:i]\n}\n\nfunc parseOptionArg(s string) string {\n\ti := strings.Index(s, \"(\")\n\tif i >= 0 {\n\t\tj := strings.Index(s, \")\")\n\t\tif j > i {\n\t\t\treturn s[i+1 : j]\n\t\t}\n\t}\n\treturn \"\"\n}","sourceCodeStart":996,"sourceCodeEnd":1032,"githubUrl":"https://github.com/hibiken/asynq/blob/d135f1439bee74e989b7f9b41ecd542cc87f024a/inspector.go#L996-L1032","documentation":"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.","triggerScenarios":"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.","commonSituations":"Hand-written option strings in config files or CLI flags; shell quoting that stripped parentheses; copying options between library versions with different option sets.","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)."],"exampleFix":"// before\nopts := []string{\"MaxRetry\", \"Queue(email)\"}\n// after\nopts := []string{\"MaxRetry(5)\", \"Queue(\\\"email\\\")\"}","handlingStrategy":"validation","validationCode":"if !regexp.MustCompile(`^[A-Za-z]\\w*\\(.*\\)$`).MatchString(optStr) { return fmt.Errorf(\"malformed option %q\", optStr) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["option-parsing","invalid-format","asynq"],"backgroundTag":"invalid-argument-format","analyzedSha":"d135f1439bee74e989b7f9b41ecd542cc87f024a","analyzedAt":"2026-09-07T19:02:34.660Z","contentChangedAt":"2026-09-07T19:02:34.660Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}