goharbor/harbor · error · Exception
127.0.0.1 can not be the hostname
Error message
127.0.0.1 can not be the hostname
What it means
The payload-side check of SBOM manager UpdateReportData: the uuid argument passed validation but the report string is empty, so the update is refused rather than blanking the stored SBOM. As with the vulnerability-report twin, it is argument validation before the DAO is called.
Source
Thrown at make/photon/prepare/utils/configs.py:23
from urllib.parse import urlencode, quote
from g import versions_file_path, host_root_dir, DEFAULT_UID, INTERNAL_NO_PROXY_DN
from models import InternalTLS, Metric, Trace, PurgeUpload, Cache, Core
from utils.misc import generate_random_string, owner_can_read, other_can_read
# NOTE: https://golang.org/pkg/database/sql/#DB.SetMaxIdleConns
default_db_max_idle_conns = 2
# NOTE: https://golang.org/pkg/database/sql/#DB.SetMaxOpenConns
default_db_max_open_conns = 0
default_https_cert_path = '/your/certificate/path'
default_https_key_path = '/your/certificate/path'
REGISTRY_USER_NAME = 'harbor_registry_user'
def validate(conf: dict, **kwargs):
# hostname validate
if conf.get('hostname') == '127.0.0.1':
raise Exception("127.0.0.1 can not be the hostname")
if conf.get('hostname') == 'reg.mydomain.com':
raise Exception("Please specify hostname")
# protocol validate
protocol = conf.get("protocol")
if protocol == "https":
if not conf.get("cert_path") or conf["cert_path"] == default_https_cert_path:
raise Exception("Error: The protocol is https but attribute ssl_cert is not set")
if not conf.get("cert_key_path") or conf['cert_key_path'] == default_https_key_path:
raise Exception("Error: The protocol is https but attribute ssl_cert_key is not set")
if protocol == "http":
logging.warning("WARNING: HTTP protocol is insecure. Harbor will deprecate http protocol in the future. Please make sure to upgrade to https")
# log endpoint validate
if ('log_ep_host' in conf) and not conf['log_ep_host']:
raise Exception('Error: must set log endpoint host to enable external host')
if ('log_ep_port' in conf) and not conf['log_ep_port']:
raise Exception('Error: must set log endpoint port to enable external host')View on GitHub (pinned to 7b2fd08cc5)
Solutions
- Verify the SBOM payload is non-empty at the point it is read and surface the read error
- Guard both uuid and payload before calling UpdateReportData
- Never use this method to clear an SBOM — delete the report instead
Example fix
// before
err := mgr.UpdateReportData(ctx, uuid, sbomJSON) // sbomJSON may be ""
// after
if strings.TrimSpace(sbomJSON) == "" {
return fmt.Errorf("sbom payload for %s is empty; refusing to store", uuid)
}
err := mgr.UpdateReportData(ctx, uuid, sbomJSON) Defensive patterns
Strategy: validation
Validate before calling
if strings.TrimSpace(report) == "" {
return fmt.Errorf("sbom payload empty; refusing update for %s", uuid)
}
return mgr.UpdateReportData(ctx, uuid, report) Try / catch
if err := mgr.UpdateReportData(ctx, uuid, report); err != nil {
if strings.Contains(err.Error(), "missing report JSON data") {
log.Printf("empty sbom body for %s; check adapter response", uuid)
}
return err
} Prevention
- Check the SBOM payload length where it is read from the adapter or store
- Never swallow read errors that can yield empty payloads
- Use the delete API to remove SBOMs, never an empty update
When it happens
Trigger: UpdateReportData(ctx, uuid, "") — the SBOM content read from the adapter response or object store came back empty while the read error was swallowed.
Common situations: Adapter 200-with-empty-body responses; empty blobs read from storage backends; the report variable assigned in a branch that did not execute.
Related errors
- purge upload interval should set with with nh, n is the numb
- purge upload interval should set with with nh, n is the numb
- cache expire hours should be positive number
- invalid quota update provider: {}
- File {} not exist
AI-assisted analysis of goharbor/harbor@7b2fd08cc5 (2026-08-16).
Data as JSON: /api/errors/558526ab9ef94e4c.
Report an issue: GitHub.