goharbor/harbor · error · Exception
purge upload interval should set with with nh, n is the numb
Error message
purge upload interval should set with with nh, n is the number of hour
What it means
SBOM report manager Create requires an actual report object; passing a nil *model.Report returns 'nil sbom report object' before any field checks, UUID generation, or DB insert. It is the first and coarsest validation in the create path.
Source
Thrown at make/photon/prepare/models.py:222
self.age = config.get('age') or '168h'
self.interval = config.get('interval') or '24h'
self.dryrun = config.get('dryrun') or False
return
def validate(self):
if not self.enabled:
return
# age should end with h
if not isinstance(self.age, str) or not self.age.endswith('h'):
raise Exception('purge upload age should set with with nh, n is the number of hour')
# interval should larger than 2h
age = self.age[:-1]
if not age.isnumeric() or int(age) < 2:
raise Exception('purge upload age should set with with nh, n is the number of hour and n should not be less than 2')
# interval should end with h
if not isinstance(self.interval, str) or not self.interval.endswith('h'):
raise Exception('purge upload interval should set with with nh, n is the number of hour')
# interval should larger than 2h
interval = self.interval[:-1]
if not interval.isnumeric() or int(interval) < 2:
raise Exception('purge upload interval should set with with nh, n is the number of hour and n should not beless than 2')
return
class Cache:
def __init__(self, config: dict):
if not config:
self.enabled = False
self.enabled = config.get('enabled')
self.expire_hours = config.get('expire_hours')
def validate(self):
if not self.enabled:
return
View on GitHub (pinned to 7b2fd08cc5)
Solutions
- Non-nil check the report at the call site with a descriptive error
- Propagate unmarshal/decode errors from SBOM parsing instead of continuing with nil
- Construct the report in one place right before calling Create
Example fix
// before
id, err := mgr.Create(ctx, r) // r may be nil
// after
if r == nil {
return "", errors.New("sbom report not built: decode failed earlier")
}
id, err := mgr.Create(ctx, r) Defensive patterns
Strategy: validation
Validate before calling
if r == nil {
return errors.New("sbom report not built")
}
return mgr.Create(ctx, r) Try / catch
if _, err := mgr.Create(ctx, r); err != nil {
if strings.Contains(err.Error(), "nil sbom report object") {
return errors.New("report decode failed upstream; nothing to create")
}
return err
} Prevention
- Propagate decode errors instead of continuing with nil
- Construct the report object immediately before Create
- Add nil checks in ingest pipelines that read external payloads
When it happens
Trigger: mgr.Create(ctx, nil); or Create(ctx, r) where r stayed nil because unmarshalling of the SBOM payload failed and the error was ignored.
Common situations: Ingest code that decodes an SBOM body but discards the decode error; conditional report construction skipped under an early return; refactors that changed Create to take a pointer.
Related errors
- purge upload interval should set with with nh, n is the numb
- cache expire hours should be positive number
- invalid quota update provider: {}
- 127.0.0.1 can not be the hostname
- File {} not exist
AI-assisted analysis of goharbor/harbor@7b2fd08cc5 (2026-08-16).
Data as JSON: /api/errors/b04491513fa20a4b.
Report an issue: GitHub.