{"record":{"id":"d36e19e25a5e9c4d","repo":"projectdiscovery/katana","slug":"no-token-found-in-capsolver-solution-key-s","errorCode":null,"errorMessage":"no token found in capsolver solution (key=%s)","messagePattern":"no token found in capsolver solution \\(key=(.+?)\\)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/engine/headless/captcha/capsolver/capsolver.go","lineNumber":206,"sourceCode":"\t}\n\n\tvar result getTaskResultResponse\n\tif err := json.Unmarshal(respBody, &result); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &result, nil\n}\n\nfunc extractToken(solution map[string]any, provider captcha.Provider) (*captcha.Solution, error) {\n\t// capsolver returns turnstile tokens under \"token\", everything else under \"gRecaptchaResponse\"\n\tkey := \"gRecaptchaResponse\"\n\tif provider == captcha.ProviderTurnstile {\n\t\tkey = \"token\"\n\t}\n\n\ttoken, ok := solution[key].(string)\n\tif !ok || token == \"\" {\n\t\treturn nil, fmt.Errorf(\"no token found in capsolver solution (key=%s)\", key)\n\t}\n\n\treturn &captcha.Solution{Token: token, Provider: provider}, nil\n}\n","sourceCodeStart":188,"sourceCodeEnd":211,"githubUrl":"https://github.com/projectdiscovery/katana/blob/e3e742739c3746f085943ce918fb4e2b8daf6fe6/pkg/engine/headless/captcha/capsolver/capsolver.go#L188-L211","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"sol, err := solver.Solve(ctx, info)\nif err != nil && strings.Contains(err.Error(), \"no token found in capsolver solution\") {\n\t// log solution keys (via debug), skip or retry with different task type\n}","preventionTips":["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"],"tags":["capsolver","captcha","schema-mismatch","api-response"],"backgroundTag":"captcha-solution-missing-token","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"}