{"record":{"id":"2c219cbddd60f50a","repo":"goharbor/harbor","slug":"please-specify-hostname","errorCode":null,"errorMessage":"Please specify hostname","messagePattern":"Please specify hostname","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"make/photon/prepare/utils/configs.py","lineNumber":25,"sourceCode":"from models import InternalTLS, Metric, Trace, PurgeUpload, Cache, Core\nfrom utils.misc import generate_random_string, owner_can_read, other_can_read\n\n# NOTE: https://golang.org/pkg/database/sql/#DB.SetMaxIdleConns\ndefault_db_max_idle_conns = 2\n# NOTE: https://golang.org/pkg/database/sql/#DB.SetMaxOpenConns\ndefault_db_max_open_conns = 0\ndefault_https_cert_path = '/your/certificate/path'\ndefault_https_key_path = '/your/certificate/path'\n\nREGISTRY_USER_NAME = 'harbor_registry_user'\n\n\ndef validate(conf: dict, **kwargs):\n    # hostname validate\n    if conf.get('hostname') == '127.0.0.1':\n        raise Exception(\"127.0.0.1 can not be the hostname\")\n    if conf.get('hostname') == 'reg.mydomain.com':\n        raise Exception(\"Please specify hostname\")\n\n    # protocol validate\n    protocol = conf.get(\"protocol\")\n    if protocol == \"https\":\n        if not conf.get(\"cert_path\") or conf[\"cert_path\"] == default_https_cert_path:\n            raise Exception(\"Error: The protocol is https but attribute ssl_cert is not set\")\n        if not conf.get(\"cert_key_path\") or conf['cert_key_path'] == default_https_key_path:\n            raise Exception(\"Error: The protocol is https but attribute ssl_cert_key is not set\")\n    if protocol == \"http\":\n        logging.warning(\"WARNING: HTTP protocol is insecure. Harbor will deprecate http protocol in the future. Please make sure to upgrade to https\")\n\n    # log endpoint validate\n    if ('log_ep_host' in conf) and not conf['log_ep_host']:\n        raise Exception('Error: must set log endpoint host to enable external host')\n    if ('log_ep_port' in conf) and not conf['log_ep_port']:\n        raise Exception('Error: must set log endpoint port to enable external host')\n    if ('log_ep_protocol' in conf) and (conf['log_ep_protocol'] not in ['udp', 'tcp']):\n        raise Exception(\"Protocol in external log endpoint must be one of 'udp' or 'tcp' \")","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/make/photon/prepare/utils/configs.py#L7-L43","documentation":"Thrown by Harbor's prepare-time validator (make/photon/prepare/utils/configs.py, validate()) when the harbor.yml 'hostname' still equals the template placeholder 'reg.mydomain.com'. The hostname builds Harbor's public URL, registry endpoints, and generated certificates, so a placeholder value would break every push/pull and browser redirect. The prepare step aborts before any container is started.","triggerScenarios":"Running ./install.sh or the prepare command with harbor.yml where 'hostname: reg.mydomain.com' was left unchanged from harbor.yml.tmpl. The check is an exact string comparison, so any other value passes (a sibling check rejects 127.0.0.1).","commonSituations":"Fresh installs where only harbor_admin_password was edited; copying the template to harbor.yml in CI and forgetting the hostname; following tutorials that keep the sample file.","solutions":["Edit harbor.yml and set 'hostname:' to the real FQDN or IP that clients will use to reach Harbor","If Harbor sits behind a load balancer or proxy, use that public address","Do not use 127.0.0.1 (rejected by the adjacent check at configs.py:22)","Re-run ./install.sh (or ./prepare) and confirm the error is gone"],"exampleFix":"# harbor.yml (before)\nhostname: reg.mydomain.com\n\n# harbor.yml (after)\nhostname: harbor.example.com","handlingStrategy":"validation","validationCode":"# pre-flight check before running install.sh\nimport yaml\ncfg = yaml.safe_load(open('harbor.yml'))\nh = cfg.get('hostname')\nif not h or h in ('reg.mydomain.com', '127.0.0.1'):\n    raise SystemExit('Set a real hostname in harbor.yml before installing')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never copy harbor.yml.tmpl to harbor.yml without editing hostname","Treat reg.mydomain.com and 127.0.0.1 as sentinel values in config reviews","Add the hostname check to CI for generated harbor.yml files"],"tags":["harbor","configuration","installation","validation"],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}