projectdiscovery/subfinder · error

chinaz: unexpected response shape, missing…

Error message

chinaz: unexpected response shape, missing Result.ContributingSubdomainList

What it means

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.

Solutions

  1. Verify the Chinaz API key in the provider config is valid and active
  2. Check your Chinaz quota/plan — error responses often lack the expected shape
  3. Update subfinder in case the Chinaz API schema changed and the parser needs fixing
  4. Inspect the raw response (debug logging) to confirm what the API actually returned
Defensive patterns

Strategy: try-catch

Try / catch

for result := range results {
    if result.Type == subscraping.Error {
        gologger.Warning().Msgf("chinaz: %v", result.Error)
        continue
    }
    // process result
}

Prevention

When it happens

Trigger: Chinaz API returns JSON where Result.ContributingSubdomainList is absent or not an array — invalid/expired API key responses, error payloads, or API schema changes.

Common situations: Missing or invalid Chinaz API key causing an error body without the expected shape; Chinaz API version changes renaming fields; quota-limited responses.

Understand the failure class

Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.

Related errors


AI-assisted analysis of projectdiscovery/subfinder@7a0b91f0fa (2026-09-06). Data as JSON: /api/errors/cc46f352166247b2. Report an issue: GitHub.

Appendix: source

Thrown at pkg/subscraping/sources/chinaz/chinaz.go:62

		resp, err := session.SimpleGet(ctx, fmt.Sprintf("https://apidatav2.chinaz.com/single/alexa?key=%s&domain=%s", randomApiKey, domain))
		if err != nil {
			results <- subscraping.Result{Source: s.Name(), Type: subscraping.Error, Error: err}
			s.errors++
			session.DiscardHTTPResponse(resp)
			return
		}

		body, err := io.ReadAll(resp.Body)
		session.DiscardHTTPResponse(resp)
		if err != nil {
			results <- subscraping.Result{Source: s.Name(), Type: subscraping.Error, Error: err}
			s.errors++
			return
		}

		SubdomainList := jsoniter.Get(body, "Result").Get("ContributingSubdomainList")
		if SubdomainList.ValueType() != jsoniter.ArrayValue {
			results <- subscraping.Result{Source: s.Name(), Type: subscraping.Error, Error: fmt.Errorf("chinaz: unexpected response shape, missing Result.ContributingSubdomainList")}
			s.errors++
			return
		}

		_data := []byte(SubdomainList.ToString())
		for i := 0; i < SubdomainList.Size(); i++ {
			subdomain := jsoniter.Get(_data, i, "DataUrl").ToString()
			select {
			case <-ctx.Done():
				return
			case results <- subscraping.Result{Source: s.Name(), Type: subscraping.Subdomain, Value: subdomain}:
				s.results++
			}
		}
	}()

	return results
}

View on GitHub (pinned to 7a0b91f0fa)