projectdiscovery/subfinder · error
unexpected status code
Error message
unexpected status code %d
What it means
The Digitalyama source, when the API responds with a non-success status code, tries to decode a structured error body ({detail: [{msg, type}]}). If that decode itself fails, it falls back to emitting fmt.Errorf("unexpected status code %d", resp.StatusCode) — a plain HTTP status error.
Solutions
- Check/fix the Digitalyama API key in the provider config
- Confirm the status code context: 401/403 → credentials, 429 → backoff and slow down, 5xx → retry later
- Ensure no proxy/WAF is altering responses for the endpoint
- Retry with backoff or disable the digitalyama source temporarily
Defensive patterns
Strategy: try-catch
Try / catch
for result := range results {
if result.Type == subscraping.Error {
gologger.Warning().Msgf("digitalyama: %v", result.Error)
continue
}
// process result
} Prevention
- Keep the Digitalyama API key valid
- Back off on 429s; retry on 5xx
- Ensure no proxy/WAF rewrites responses
- Handle Error-type results per source
When it happens
Trigger: Digitalyama API returns an unexpected status code whose body is not the documented error shape (undecodable JSON) — auth failures, rate limiting, outages, proxies returning HTML error pages.
Common situations: Invalid/missing Digitalyama API key; hitting request quotas; a proxy or WAF intercepting the request and returning non-JSON; Digitalyama service disruption.
Related errors
AI-assisted analysis of projectdiscovery/subfinder@7a0b91f0fa (2026-09-06).
Data as JSON: /api/errors/d8c6eb19c8cdc19e.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/subscraping/sources/digitalyama/digitalyama.go:77
}
defer func() {
if err := resp.Body.Close(); err != nil {
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Error, Error: err}
s.errors++
}
}()
if resp.StatusCode != 200 {
var errResponse struct {
Detail []struct {
Loc []string `json:"loc"`
Msg string `json:"msg"`
Type string `json:"type"`
} `json:"detail"`
}
err = jsoniter.NewDecoder(resp.Body).Decode(&errResponse)
if err != nil {
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Error, Error: fmt.Errorf("unexpected status code %d", resp.StatusCode)}
s.errors++
return
}
if len(errResponse.Detail) > 0 {
errMsg := errResponse.Detail[0].Msg
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Error, Error: fmt.Errorf("%s (code %d)", errMsg, resp.StatusCode)}
} else {
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Error, Error: fmt.Errorf("unexpected status code %d", resp.StatusCode)}
}
s.errors++
return
}
var response digitalYamaResponse
err = jsoniter.NewDecoder(resp.Body).Decode(&response)
if err != nil {
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Error, Error: err}
s.errors++View on GitHub (pinned to 7a0b91f0fa)