projectdiscovery/katana · error
no token found in capsolver solution (key=%s)
Error message
no token found in capsolver solution (key=%s)
What it means
When CapSolver reports status="ready", extractToken reads the solution map under key "gRecaptchaResponse" (or "token" for Turnstile) and type-asserts it to a non-empty string. If the key is missing, holds a non-string (e.g. null), or is an empty string, this error is thrown. It indicates a response shape the library does not recognize.
Source
Thrown at pkg/engine/headless/captcha/capsolver/capsolver.go:206
}
var result getTaskResultResponse
if err := json.Unmarshal(respBody, &result); err != nil {
return nil, err
}
return &result, nil
}
func extractToken(solution map[string]any, provider captcha.Provider) (*captcha.Solution, error) {
// capsolver returns turnstile tokens under "token", everything else under "gRecaptchaResponse"
key := "gRecaptchaResponse"
if provider == captcha.ProviderTurnstile {
key = "token"
}
token, ok := solution[key].(string)
if !ok || token == "" {
return nil, fmt.Errorf("no token found in capsolver solution (key=%s)", key)
}
return &captcha.Solution{Token: token, Provider: provider}, nil
}
View on GitHub (pinned to e3e742739c)
Solutions
- Log the full solution map to see what keys CapSolver actually returned
- Verify the provider detected on the page is correct (wrong Provider makes extractToken look for the wrong key)
- Check the CapSolver API changelog for solution-schema changes and update the library
- Update katana to the latest version where new task-type keys may be handled
- If it persists, report the provider+taskType combination; as a workaround, catch this error and skip the target
Defensive patterns
Strategy: try-catch
Try / catch
sol, err := solver.Solve(ctx, info)
if err != nil && strings.Contains(err.Error(), "no token found in capsolver solution") {
// log solution keys (via debug), skip or retry with different task type
} Prevention
- Keep katana updated against CapSolver API schema changes
- Verify provider detection is correct so the right solution key is read
- Log unexpected solution payloads for debugging
- Alert on repeated occurrences — they indicate upstream API drift
When it happens
Trigger: CapSolver returns a solution with a different field name for the provider (API schema drift), solution is null/absent, or the value is empty because the solve returned a degraded result.
Common situations: CapSolver changes its solution payload format; a task type that returns extra fields without gRecaptchaResponse; an unexpected provider value reaching extractToken so the wrong key is used; proxyless tasks returning alternate keys like "gRecaptchaResponse" empty on failure.
Related errors
- unsupported captcha provider for capsolver: %s
- create task: %w
- capsolver error %s: %s
- captcha solve timed out after %s
- captcha solve: %w
AI-assisted analysis of projectdiscovery/katana@e3e742739c (2026-09-03).
Data as JSON: /api/errors/d36e19e25a5e9c4d.
Report an issue: GitHub.