{"record":{"id":"cc46f352166247b2","repo":"projectdiscovery/subfinder","slug":"chinaz-unexpected-response-shape-missing-result","errorCode":null,"errorMessage":"chinaz: unexpected response shape, missing Result.ContributingSubdomainList","messagePattern":"chinaz: unexpected response shape, missing Result\\.ContributingSubdomainList","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/subscraping/sources/chinaz/chinaz.go","lineNumber":62,"sourceCode":"\t\tresp, err := session.SimpleGet(ctx, fmt.Sprintf(\"https://apidatav2.chinaz.com/single/alexa?key=%s&domain=%s\", randomApiKey, domain))\n\t\tif err != nil {\n\t\t\tresults <- subscraping.Result{Source: s.Name(), Type: subscraping.Error, Error: err}\n\t\t\ts.errors++\n\t\t\tsession.DiscardHTTPResponse(resp)\n\t\t\treturn\n\t\t}\n\n\t\tbody, err := io.ReadAll(resp.Body)\n\t\tsession.DiscardHTTPResponse(resp)\n\t\tif err != nil {\n\t\t\tresults <- subscraping.Result{Source: s.Name(), Type: subscraping.Error, Error: err}\n\t\t\ts.errors++\n\t\t\treturn\n\t\t}\n\n\t\tSubdomainList := jsoniter.Get(body, \"Result\").Get(\"ContributingSubdomainList\")\n\t\tif SubdomainList.ValueType() != jsoniter.ArrayValue {\n\t\t\tresults <- subscraping.Result{Source: s.Name(), Type: subscraping.Error, Error: fmt.Errorf(\"chinaz: unexpected response shape, missing Result.ContributingSubdomainList\")}\n\t\t\ts.errors++\n\t\t\treturn\n\t\t}\n\n\t\t_data := []byte(SubdomainList.ToString())\n\t\tfor i := 0; i < SubdomainList.Size(); i++ {\n\t\t\tsubdomain := jsoniter.Get(_data, i, \"DataUrl\").ToString()\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\tcase results <- subscraping.Result{Source: s.Name(), Type: subscraping.Subdomain, Value: subdomain}:\n\t\t\t\ts.results++\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn results\n}","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/projectdiscovery/subfinder/blob/7a0b91f0fac01b62c65328bd771a3560ae611d6a/pkg/subscraping/sources/chinaz/chinaz.go#L44-L80","documentation":"The Chinaz source validates that the API response JSON contains Result.ContributingSubdomainList as an array before parsing. If the JSON shape deviates (field missing or wrong type), it emits this descriptive error Result instead of panicking on a nil/malformed structure.","triggerScenarios":"Chinaz API returns JSON where Result.ContributingSubdomainList is absent or not an array — invalid/expired API key responses, error payloads, or API schema changes.","commonSituations":"Missing or invalid Chinaz API key causing an error body without the expected shape; Chinaz API version changes renaming fields; quota-limited responses.","solutions":["Verify the Chinaz API key in the provider config is valid and active","Check your Chinaz quota/plan — error responses often lack the expected shape","Update subfinder in case the Chinaz API schema changed and the parser needs fixing","Inspect the raw response (debug logging) to confirm what the API actually returned"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"for result := range results {\n    if result.Type == subscraping.Error {\n        gologger.Warning().Msgf(\"chinaz: %v\", result.Error)\n        continue\n    }\n    // process result\n}","preventionTips":["Use a valid, active Chinaz API key","Keep subfinder updated for API schema changes","Treat Error-type results as source-specific, not fatal"],"tags":["chinaz","api","json"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"7a0b91f0fac01b62c65328bd771a3560ae611d6a","analyzedAt":"2026-09-06T23:52:02.109Z","contentChangedAt":"2026-09-06T23:52:02.109Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}