{"record":{"id":"801a743d2e6391af","repo":"projectdiscovery/katana","slug":"unsupported-captcha-provider-for-capsolver-s","errorCode":null,"errorMessage":"unsupported captcha provider for capsolver: %s","messagePattern":"unsupported captcha provider for capsolver: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/engine/headless/captcha/capsolver/capsolver.go","lineNumber":56,"sourceCode":"}\n\nfunc init() {\n\tcaptcha.RegisterSolver(\"capsolver\", func(apiKey string) (captcha.Solver, error) {\n\t\treturn New(apiKey), nil\n\t})\n}\n\nfunc New(apiKey string) *Solver {\n\treturn &Solver{\n\t\tapiKey: apiKey,\n\t\tclient: &http.Client{Timeout: 30 * time.Second},\n\t}\n}\n\nfunc (s *Solver) Solve(ctx context.Context, info *captcha.Info) (*captcha.Solution, error) {\n\ttaskType, ok := taskTypes[info.Provider]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unsupported captcha provider for capsolver: %s\", info.Provider)\n\t}\n\n\ttask := map[string]any{\n\t\t\"type\":       taskType,\n\t\t\"websiteURL\": info.PageURL,\n\t\t\"websiteKey\": info.SiteKey,\n\t}\n\tif (info.Provider == captcha.ProviderRecaptchaV3 || info.Provider == captcha.ProviderRecaptchaV3Enterprise) && info.Action != \"\" {\n\t\ttask[\"pageAction\"] = info.Action\n\t}\n\n\ttaskID, err := s.createTask(ctx, task)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"create task: %w\", err)\n\t}\n\n\treturn s.pollResult(ctx, taskID, info.Provider)\n}","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/projectdiscovery/katana/blob/e3e742739c3746f085943ce918fb4e2b8daf6fe6/pkg/engine/headless/captcha/capsolver/capsolver.go#L38-L74","documentation":"capsolver.Solver.Solve returns this when info.Provider is not a key in the taskTypes map, i.e. the captcha provider is one the capsolver integration does not support (it supports reCAPTCHA v2/v3 (+Enterprise), Turnstile, and hCaptcha). The solver cannot map the provider to a capsolver task type and fails before making any API call.","triggerScenarios":"Calling Solve(ctx, info) (directly or via solveCaptcha) with info.Provider set to a provider outside taskTypes — e.g. image captcha, FunCaptcha, or a provider only supported by another solver backend.","commonSituations":"Configuring capsolver as the captcha solver while the target site presents a captcha type capsolver integration doesn't map; provider auto-detection returning a provider name not in the map; mixing solver backends where a provider is supported by 2captcha but not capsolver.","solutions":["Check the provider in captcha.Info against the taskTypes map in capsolver.go and use a supported one (RecaptchaV2/V3, Enterprise variants, Turnstile, HCaptcha).","Switch the solver backend (e.g. 2captcha) for providers capsolver does not support.","Update the library or add an entry to taskTypes if the provider has a capsolver equivalent.","Log the detected provider before solving to catch misdetection early."],"exampleFix":"// before\nsolver := capsolver.New(apiKey)\nsol, err := solver.Solve(ctx, &captcha.Info{Provider: captcha.ProviderFuncaptcha, ...}) // unsupported\n// after\nif info.Provider == captcha.ProviderFuncaptcha {\n    solver, _ = twocaptcha.New(apiKey) // backend that supports it\n}\nsol, err := solver.Solve(ctx, info)","handlingStrategy":"validation","validationCode":"var supportedByCapsolver = map[captcha.Provider]bool{\n    captcha.ProviderRecaptchaV2: true, captcha.ProviderRecaptchaV3: true,\n    captcha.ProviderRecaptchaV2Enterprise: true, captcha.ProviderRecaptchaV3Enterprise: true,\n    captcha.ProviderTurnstile: true, captcha.ProviderHCaptcha: true,\n}\nif !supportedByCapsolver[info.Provider] {\n    return nil, fmt.Errorf(\"provider %s not supported by capsolver\", info.Provider)\n}","typeGuard":null,"tryCatchPattern":"sol, err := solver.Solve(ctx, info)\nif err != nil {\n    if strings.HasPrefix(err.Error(), \"unsupported captcha provider for capsolver\") {\n        return nil, fallbackSolver.Solve(ctx, info) // route to a backend that supports it\n    }\n    return nil, err\n}","preventionTips":["Map captcha providers to solver backends in configuration and route unsupported ones elsewhere","Log the detected provider before solving","Keep the taskTypes map in sync with any custom providers you register"],"tags":["captcha","capsolver","unsupported-provider","go"],"backgroundTag":"unsupported-captcha-provider","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"}