goharbor/harbor · error

no way to get report summaries for nil artifact

Error message

no way to get report summaries for nil artifact

What it means

Guard in vulnerability scanHandler.GetSummary: the artifact is nil, so vulnerability report summaries cannot be retrieved — the artifact identity is required.

Solutions

  1. Resolve the artifact by reference before calling GetSummary
  2. Return the upstream artifact-resolution error to the client instead of nil
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/pkg/scan/vulnerability/vul.go:276 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of goharbor/harbor@7b2fd08cc5 (2026-08-16). Data as JSON: /api/errors/ebcbbc6aee4a765b. Report an issue: GitHub.

Appendix: source

Thrown at src/pkg/scan/vulnerability/vul.go:276

}

// URLParameter vulnerability doesn't require any scan report parameters
func (h *scanHandler) URLParameter(_ *v1.ScanRequest) (string, error) {
	return "", nil
}

func (h *scanHandler) Update(ctx context.Context, uuid string, rpt string) error {
	reportMgr := h.ReportMgrFunc()
	if err := reportMgr.UpdateReportData(ctx, uuid, rpt); err != nil {
		return err
	}
	return nil
}

func (h *scanHandler) GetSummary(ctx context.Context, ar *artifact.Artifact, mimeTypes []string) (map[string]any, error) {
	bc := h.ScanControllerFunc()
	if ar == nil {
		return nil, errors.New("no way to get report summaries for nil artifact")
	}
	// Get reports first
	rps, err := bc.GetReport(ctx, ar, mimeTypes)
	if err != nil {
		return nil, err
	}
	summaries := make(map[string]any, len(rps))
	for _, rp := range rps {
		sum, err := report.GenerateSummary(rp)
		if err != nil {
			return nil, err
		}

		if s, ok := summaries[rp.MimeType]; ok {
			r, err := report.MergeSummary(rp.MimeType, s, sum)
			if err != nil {
				return nil, err
			}

View on GitHub (pinned to 7b2fd08cc5)