projectdiscovery/katana · error
unsupported captcha solver provider: %s
Error message
unsupported captcha solver provider: %s
What it means
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.
Source
Thrown at pkg/engine/headless/captcha/solver.go:20
import (
"context"
"fmt"
)
type Solution struct {
Token string
Provider Provider
}
type Solver interface {
Solve(ctx context.Context, info *Info) (*Solution, error)
}
func NewSolver(provider, apiKey string) (Solver, error) {
constructor, ok := solverRegistry[provider]
if !ok {
return nil, fmt.Errorf("unsupported captcha solver provider: %s", provider)
}
return constructor(apiKey)
}
type SolverConstructor func(apiKey string) (Solver, error)
var solverRegistry = map[string]SolverConstructor{}
func RegisterSolver(name string, constructor SolverConstructor) {
solverRegistry[name] = constructor
}
View on GitHub (pinned to e3e742739c)
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
Example fix
// before
provider := strings.TrimSpace(opts.CaptchaSolver) // "Capsolver"
// after
provider := strings.ToLower(strings.TrimSpace(opts.CaptchaSolver))
if _, err := captcha.NewSolver(provider, apiKey); err != nil {
return fmt.Errorf("invalid captcha solver %q: %w", provider, err)
} Defensive patterns
Strategy: validation
Validate before calling
func isValidSolver(name string) bool {
return map[string]bool{"capsolver": true}[strings.ToLower(strings.TrimSpace(name))]
}
if !isValidSolver(cfg.CaptchaSolverProvider) {
return errors.New("unsupported captcha solver provider in config")
} Try / catch
solver, err := captcha.NewSolver(provider, apiKey)
if err != nil {
return nil, fmt.Errorf("solver %q not registered: %w", provider, err)
} Prevention
- 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
When it happens
Trigger: 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".
Common situations: 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.
Related errors
- captcha solver init: %w
- unsupported captcha provider for capsolver: %s
- create task: %w
- capsolver error %s: %s
- captcha solve timed out after %s
AI-assisted analysis of projectdiscovery/katana@e3e742739c (2026-09-03).
Data as JSON: /api/errors/cf9b572ae2ccc144.
Report an issue: GitHub.