{"record":{"id":"568100a53d4537df","repo":"rakyll/hey","slug":"could-not-parse-the-provided-input-input-v","errorCode":null,"errorMessage":"could not parse the provided input; input = %v","messagePattern":"could not parse the provided input; input = (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hey.go","lineNumber":275,"sourceCode":"\tfmt.Fprintf(os.Stderr, \"\\n\")\n\tos.Exit(1)\n}\n\nfunc usageAndExit(msg string) {\n\tif msg != \"\" {\n\t\tfmt.Fprintf(os.Stderr, \"%s\", msg)\n\t\tfmt.Fprintf(os.Stderr, \"\\n\\n\")\n\t}\n\tflag.Usage()\n\tfmt.Fprintf(os.Stderr, \"\\n\")\n\tos.Exit(1)\n}\n\nfunc parseInputWithRegexp(input, regx string) ([]string, error) {\n\tre := regexp.MustCompile(regx)\n\tmatches := re.FindStringSubmatch(input)\n\tif len(matches) < 1 {\n\t\treturn nil, fmt.Errorf(\"could not parse the provided input; input = %v\", input)\n\t}\n\treturn matches, nil\n}\n\ntype headerSlice []string\n\nfunc (h *headerSlice) String() string {\n\treturn fmt.Sprintf(\"%s\", *h)\n}\n\nfunc (h *headerSlice) Set(value string) error {\n\t*h = append(*h, value)\n\treturn nil\n}\n","sourceCodeStart":257,"sourceCodeEnd":290,"githubUrl":"https://github.com/rakyll/hey/blob/5626f79b8698df6daf9b25799c9805c6acc96740/hey.go#L257-L290","documentation":"parseInputWithRegexp in hey.go validates CLI flag values (such as -H header and -a auth values) against a regular expression and returns this error when FindStringSubmatch finds no matches, i.e. the input does not conform to the expected format. It is a user-input validation error, not a runtime fault: the value passed to the flag simply doesn't match the required pattern. The raw input is included in the message via %v so the offending value can be identified.","triggerScenarios":"Running hey with a -H value that isn't in 'Name: Value' form (e.g. -H 'HeaderName' with no colon, or a missing/empty value), or an -a/--auth value that doesn't match the expected 'username:password' or Basic-auth shape, so the corresponding regexp returns zero submatches.","commonSituations":"Typing a header flag with a space instead of a colon (-H 'Content-Type application/json' instead of -H 'Content-Type: application/json'), forgetting the colon separator entirely, passing an auth value without ':' for basic auth, quoting/shell-escaping mistakes that mangle the flag value, or automated scripts invoking hey with empty flag values.","solutions":["Check the flag value against the required format and fix it: headers must be 'Name: Value' with an explicit colon and space, auth must match the expected 'user:password' pattern.","Quote the argument in your shell so special characters or meta characters in headers/auth are passed through intact (e.g. -H 'Content-Type: application/json').","If invoked programmatically, print/inspect the argv actually passed to hey to confirm no argument was dropped or split incorrectly.","If you are the maintainer, consider improving the error to name which flag failed (e.g. wrap with fmt.Errorf(\"invalid -H value %q: %w\", input, err)) for easier diagnosis."],"exampleFix":"// before\n$ hey -n 10 -H \"Content-Type application/json\" https://example.com\n// error: could not parse the provided input; input = Content-Type application/json\n\n// after\n$ hey -n 10 -H \"Content-Type: application/json\" https://example.com","handlingStrategy":"validation","validationCode":"func validHeader(s string) bool {\n\treturn regexp.MustCompile(`^[^:]+:\\s*.+$`).MatchString(s)\n}\n// check each -H and -a value before invoking hey\nif !validHeader(hdr) {\n\treturn fmt.Errorf(\"invalid -H value %q: must be 'Name: Value'\", hdr)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always write header flags as -H 'Name: Value' with an explicit colon.","Quote flag values in the shell to prevent spaces and meta characters from splitting arguments.","Validate auth format 'username:password' before passing to -a.","Test the exact hey command in a script with 'set -x' to see the arguments actually delivered."],"tags":["cli-input","regex-validation","flag-parsing"],"backgroundTag":"invalid-cli-flag-format","analyzedSha":"5626f79b8698df6daf9b25799c9805c6acc96740","analyzedAt":"2026-09-02T10:01:29.707Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T16:17:10.729Z"}