breymander commented on issue #8789:
URL:
https://github.com/apache/incubator-devlake/issues/8789#issuecomment-4112258256
**Root Cause**
Figured out what's going on. On first run, `computeReportDateRange` in
`report_download_helper.go` iterates 365 days back (`reportMaxDays = 365`), but
the Copilot Usage Metrics Reports API only has data going back to around
October 2025. For dates before that, GitHub doesn't return a `404` — it returns
a `200` with body `""`:
```
HTTP 200
Content-Length: 3
""
```
The `ignore404` callback in `report_download_helper.go` only handles 404s,
so this 200 passes straight through to the `ResponseParser` in
`org_metrics_collector.go`, which does:
```go
var meta reportMetadataResponse
if jsonErr := json.Unmarshal(body, &meta); jsonErr != nil {
return nil, errors.Default.Wrap(jsonErr, "failed to parse report
metadata")
}
```
Unmarshaling `""` into a struct fails, and the framework wraps it as the
generic "error parsing response" message.
**Suggested fix:** Check for empty/non-object bodies (`""`, `null`, empty)
before the unmarshal and skip the day instead of erroring out. Same issue
applies to `user_metrics_collector.go` and `enterprise_metrics_collector.go`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]