{"record":{"id":"8611b95de80bbace","repo":"goharbor/harbor","slug":"file-not-exist","errorCode":null,"errorMessage":"File {} not exist","messagePattern":"File (.+?) not exist","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"make/photon/prepare/models.py","lineNumber":73,"sourceCode":"\n            filename = '{}.{}'.format('_'.join(name_parts[:-2]), name_parts[-2])\n\n            if filename in self.required_filenames:\n                return os.path.join(self.data_volume, 'secret', 'tls', filename)\n\n        return object.__getattribute__(self, name)\n\n    def _check(self, filename: str):\n        \"\"\"\n        Check cert and key files are correct\n        \"\"\"\n\n        path = Path(os.path.join(internal_tls_dir, filename))\n\n        if not path.exists:\n            if filename == 'harbor_internal_ca.crt':\n                return\n            raise Exception('File {} not exist'.format(filename))\n\n        if not path.is_file:\n            raise Exception('invalid {}'.format(filename))\n\n        # check key file permission\n        if filename.endswith('.key') and not check_permission(path, mode=0o600):\n            raise Exception('key file {} permission is not 600'.format(filename))\n\n        # check certificate file\n        if filename.endswith('.crt'):\n            if not owner_can_read(path.stat().st_mode):\n                # check owner can read cert file\n                raise Exception('File {} should readable by owner'.format(filename))\n            if not san_existed(path):\n                # check SAN included\n                if filename == 'harbor_internal_ca.crt':\n                    return\n                raise Exception('cert file {} should include SAN'.format(filename))","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/make/photon/prepare/models.py#L55-L91","documentation":"Returned by basicManager.UpdateReportData in src/pkg/scan/report/manager.go when the vulnerability report manager is asked to persist a report whose JSON body is the empty string. Both uuid and report are validated before the DAO is touched, and an empty payload is refused because writing it would silently blank the stored report for that uuid. This is a pure argument-validation error, not a persistence failure.","triggerScenarios":"Calling mgr.UpdateReportData(ctx, uuid, report) with report == \"\" — typically the string obtained from the scanner adapter's GetScanReport call came back empty, or the caller passed the wrong or never-assigned variable.","commonSituations":"A scanner adapter returned HTTP 200 with an empty body and the body-read error was swallowed upstream; a marshalling step produced an empty string; refactors that renamed the payload variable and left an empty one in place.","solutions":["Length-check the report string where it is produced (adapter response read) and surface the real upstream error instead of passing it on","Guard uuid != \"\" && report != \"\" immediately before calling UpdateReportData","If the intent was to clear a report, use the delete API instead — this method intentionally rejects empty payloads"],"exampleFix":"// before\nerr := mgr.UpdateReportData(ctx, uuid, report) // report may be \"\"\n\n// after\nif strings.TrimSpace(report) == \"\" {\n    return fmt.Errorf(\"scan report for %s is empty; refusing to store\", uuid)\n}\nerr := mgr.UpdateReportData(ctx, uuid, report)","handlingStrategy":"validation","validationCode":"if uuid == \"\" || strings.TrimSpace(report) == \"\" {\n    return fmt.Errorf(\"cannot update report data: uuid=%q payload_len=%d\", uuid, len(report))\n}\nreturn mgr.UpdateReportData(ctx, uuid, report)","typeGuard":null,"tryCatchPattern":"if err := mgr.UpdateReportData(ctx, uuid, report); err != nil {\n    if strings.Contains(err.Error(), \"missing report JSON data\") {\n        // empty payload: fix the producer, do not retry with the same input\n        log.Printf(\"empty report body for uuid %s\", uuid)\n    }\n    return err\n}","preventionTips":["Treat an empty report body from any adapter as an error at fetch time, not at store time","Validate string arguments at the boundary before handing them to manager APIs","Never use UpdateReportData to blank out a stored report"],"tags":["go","harbor","scan","report","validation"],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}