{"record":{"id":"3ced6c89c86770fa","repo":"goharbor/harbor","slug":"no-mime-types-to-get-report-summaries","errorCode":null,"errorMessage":"no mime types to get report summaries","messagePattern":"no mime types to get report summaries","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/pkg/scan/sbom/sbom.go","lineNumber":300,"sourceCode":"\tmgr := h.SBOMMgrFunc()\n\trpts, err := mgr.GetBy(ctx, a.ID, scannerUUID, mimeType, sbomMediaTypeSpdx)\n\tif err != nil {\n\t\tlogger.Errorf(\"Failed to get report for artifact %s@%s of mimetype %s, error %v\", artRepo, artDigest, mimeType, err)\n\t\treturn nil, err\n\t}\n\tif len(rpts) == 0 {\n\t\tlogger.Errorf(\"No report found for artifact %s@%s of mimetype %s, error %v\", artRepo, artDigest, mimeType, err)\n\t\treturn nil, errors.NotFoundError(nil).WithMessage(\"no report found to update data\")\n\t}\n\treturn &scanModel.Report{\n\t\tUUID:     rpts[0].UUID,\n\t\tMimeType: rpts[0].MimeType,\n\t}, nil\n}\n\nfunc (h *scanHandler) GetSummary(ctx context.Context, art *artifact.Artifact, mimeTypes []string) (map[string]any, error) {\n\tif len(mimeTypes) == 0 {\n\t\treturn nil, errors.New(\"no mime types to get report summaries\")\n\t}\n\tif art == nil {\n\t\treturn nil, errors.New(\"no way to get report summaries for nil artifact\")\n\t}\n\tds := h.ScannerControllerFunc()\n\tr, err := ds.GetRegistrationByProject(ctx, art.ProjectID)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"get sbom summary failed\")\n\t}\n\treports, err := h.SBOMMgrFunc().GetBy(ctx, art.ID, r.UUID, mimeTypes[0], sbomMediaTypeSpdx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(reports) == 0 {\n\t\treturn map[string]any{}, nil\n\t}\n\treportContent := reports[0].ReportSummary\n\tresult := map[string]any{}","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/pkg/scan/sbom/sbom.go#L282-L318","documentation":"Guard in sbom GetSummary: the resolved mime-types list is empty, so no report summaries can be fetched for the artifact — there is nothing to summarize.","triggerScenarios":"Thrown at src/pkg/scan/sbom/sbom.go:300 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the mime types requested by the API client (defaults from config if unset)","Short-circuit earlier with an empty result instead of calling GetSummary with no types"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","contentChangedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}