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

  1. Log the full solution map to see what keys CapSolver actually returned
  2. Verify the provider detected on the page is correct (wrong Provider makes extractToken look for the wrong key)
  3. Check the CapSolver API changelog for solution-schema changes and update the library
  4. Update katana to the latest version where new task-type keys may be handled
  5. 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

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


AI-assisted analysis of projectdiscovery/katana@e3e742739c (2026-09-03). Data as JSON: /api/errors/d36e19e25a5e9c4d. Report an issue: GitHub.