{"record":{"id":"cf9b572ae2ccc144","repo":"projectdiscovery/katana","slug":"unsupported-captcha-solver-provider-s","errorCode":null,"errorMessage":"unsupported captcha solver provider: %s","messagePattern":"unsupported captcha solver provider: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/engine/headless/captcha/solver.go","lineNumber":20,"sourceCode":"\nimport (\n\t\"context\"\n\t\"fmt\"\n)\n\ntype Solution struct {\n\tToken    string\n\tProvider Provider\n}\n\ntype Solver interface {\n\tSolve(ctx context.Context, info *Info) (*Solution, error)\n}\n\nfunc NewSolver(provider, apiKey string) (Solver, error) {\n\tconstructor, ok := solverRegistry[provider]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unsupported captcha solver provider: %s\", provider)\n\t}\n\treturn constructor(apiKey)\n}\n\ntype SolverConstructor func(apiKey string) (Solver, error)\n\nvar solverRegistry = map[string]SolverConstructor{}\n\nfunc RegisterSolver(name string, constructor SolverConstructor) {\n\tsolverRegistry[name] = constructor\n}\n","sourceCodeStart":2,"sourceCodeEnd":32,"githubUrl":"https://github.com/projectdiscovery/katana/blob/e3e742739c3746f085943ce918fb4e2b8daf6fe6/pkg/engine/headless/captcha/solver.go#L2-L32","documentation":"NewSolver performs a lookup in solverRegistry, a map from provider name strings to constructor functions populated by each solver package's init() via captcha.RegisterSolver. If the given provider name has no entry, this error is returned. It is a configuration/name-resolution failure, not a network or API failure.","triggerScenarios":"Called by NewHandler at handler construction and directly in tests (TestNewSolver_UnsupportedProvider); fires when the provider string does not exactly match a registered key such as \"capsolver\".","commonSituations":"Case mismatch or whitespace in config (\"Capsolver\", \" capsolver\"); empty provider string; desired solver package not imported so its init() never ran; renamed provider in a newer library version.","solutions":["Compare the configured provider string against the registered keys (e.g. \"capsolver\") — exact match, lowercase","Ensure the solver package is imported so its init() registration runs","Trim whitespace and normalize case on config values before passing to NewSolver","Whitelist/validate provider names in your own config layer and fail fast with a clear message","Check the library docs for the current list of supported solvers"],"exampleFix":"// before\nprovider := strings.TrimSpace(opts.CaptchaSolver) // \"Capsolver\"\n\n// after\nprovider := strings.ToLower(strings.TrimSpace(opts.CaptchaSolver))\nif _, err := captcha.NewSolver(provider, apiKey); err != nil {\n\treturn fmt.Errorf(\"invalid captcha solver %q: %w\", provider, err)\n}","handlingStrategy":"validation","validationCode":"func isValidSolver(name string) bool {\n\treturn map[string]bool{\"capsolver\": true}[strings.ToLower(strings.TrimSpace(name))]\n}\nif !isValidSolver(cfg.CaptchaSolverProvider) {\n\treturn errors.New(\"unsupported captcha solver provider in config\")\n}","typeGuard":null,"tryCatchPattern":"solver, err := captcha.NewSolver(provider, apiKey)\nif err != nil {\n\treturn nil, fmt.Errorf(\"solver %q not registered: %w\", provider, err)\n}","preventionTips":["Normalize (lowercase/trim) provider config values","Keep the provider name in sync with the library's registered keys","Ensure solver packages are linked into your binary (init() registration)","Add a config-time smoke test calling NewSolver for the configured provider"],"tags":["captcha","config-error","registry-lookup","initialization"],"backgroundTag":"invalid-config-option","analyzedSha":"e3e742739c3746f085943ce918fb4e2b8daf6fe6","analyzedAt":"2026-09-03T14:55:13.248Z","contentChangedAt":"2026-09-03T14:55:13.248Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}