{"record":{"id":"4f1e31c3affdc3d2","repo":"sundowndev/phoneinfoga","slug":"given-phone-number-is-not-valid","errorCode":null,"errorMessage":"given phone number is not valid","messagePattern":"given phone number is not valid","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/scan.go","lineNumber":62,"sourceCode":"\t\t\terr := godotenv.Load(opts.EnvFiles...)\n\t\t\tif err != nil {\n\t\t\t\tlogrus.WithField(\"error\", err).Debug(\"Error loading .env file\")\n\t\t\t}\n\n\t\t\trunScan(opts)\n\t\t},\n\t}\n}\n\nfunc runScan(opts *ScanCmdOptions) {\n\tfmt.Fprintf(color.Output, color.WhiteString(\"Running scan for phone number %s...\\n\\n\"), opts.Number)\n\n\tif valid := number.IsValid(opts.Number); !valid {\n\t\tlogrus.WithFields(map[string]interface{}{\n\t\t\t\"input\": opts.Number,\n\t\t\t\"valid\": valid,\n\t\t}).Debug(\"Input phone number is invalid\")\n\t\texitWithError(errors.New(\"given phone number is not valid\"))\n\t}\n\n\tnum, err := number.NewNumber(opts.Number)\n\tif err != nil {\n\t\texitWithError(err)\n\t}\n\n\tfor _, p := range opts.PluginPaths {\n\t\terr := remote.OpenPlugin(p)\n\t\tif err != nil {\n\t\t\texitWithError(err)\n\t\t}\n\t}\n\n\tf := filter.NewEngine()\n\tf.AddRule(opts.DisabledScanners...)\n\n\tremoteLibrary := remote.NewLibrary(f)","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/sundowndev/phoneinfoga/blob/55807b05b753dab7bc6fe67403ca385668dda179/cmd/scan.go#L44-L80","documentation":"runScan validates the user-supplied phone number with number.IsValid before doing any work; if it fails, the CLI exits immediately with 'given phone number is not valid'. The library refuses to run any scanners on input it considers unparseable or not a real phone number.","triggerScenarios":"Running the scan command with a --number flag value that number.IsValid rejects: empty string, letters/symbols, too few digits, or a number without a valid country calling code.","commonSituations":"Forgetting the leading '+' and country code (e.g. '5551234' instead of '+15551234'), pasting numbers with formatting characters the parser does not accept, or an empty flag because the argument was never passed.","solutions":["Pass a full international-format number including '+' and country code, e.g. +14155552671","Remove spaces, dashes, parentheses, or check which formats number.IsValid accepts in the number package","Confirm the --number flag is actually populated (see the debug log field 'input' which echoes the rejected value)"],"exampleFix":"// before\nscan --number 415-555-2671\n// after\nscan --number +14155552671","handlingStrategy":"validation","validationCode":"import \"github.com/sundowndev/phonepos/lib/number\"\n\nfunc validateInput(raw string) error {\n    if !number.IsValid(raw) {\n        return fmt.Errorf(\"number %q is not a valid international phone number\", raw)\n    }\n    return nil\n}\n// call validateInput(opts.Number) before running the scan","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass E.164-style numbers: '+' + country code + subscriber number","Strip spaces/dashes before passing to the tool or ensure the parser accepts them","Add a preflight check in scripts that batch numbers, skipping invalid entries","Watch the debug log 'input' field to see exactly what value was rejected"],"tags":["cli","phone-number","input-validation"],"backgroundTag":"invalid-phone-number-input","analyzedSha":"55807b05b753dab7bc6fe67403ca385668dda179","analyzedAt":"2026-09-03T13:37:27.908Z","contentChangedAt":"2026-09-03T13:37:27.908Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}