gohugoio/hugo · error
--appendPort=false not supported when in multihost mode
Error message
--appendPort=false not supported when in multihost mode
What it means
In multihost mode (each language served on its own host), Hugo must run one listener per language, allocating sequential ports and appending each port to that language's baseURL. `--appendPort=false` would make the per-language servers indistinguishable on one origin, so `createServerPorts` rejects the combination outright.
Source
Thrown at commands/server.go:761
Roots: roots,
}
if _, err := cert.Verify(opts); err != nil {
return fmt.Errorf("failed to verify certificate: %v", err.Error())
}
return nil
}
func (c *serverCommand) createServerPorts(cd *simplecobra.Commandeer) error {
flags := cd.CobraCommand.Flags()
var cerr error
c.withConf(func(conf *commonConfig) {
isMultihost := conf.configs.IsMultihost
c.serverPorts = make([]serverPortListener, 1)
if isMultihost {
if !c.serverAppend {
cerr = errors.New("--appendPort=false not supported when in multihost mode")
return
}
c.serverPorts = make([]serverPortListener, len(conf.configs.Languages))
}
currentServerPort := c.serverPort
for i := range c.serverPorts {
l, err := net.Listen("tcp", net.JoinHostPort(c.serverInterface, strconv.Itoa(currentServerPort)))
if err == nil {
c.serverPorts[i] = serverPortListener{ln: l, p: currentServerPort}
} else {
if i == 0 && flags.Changed("port") {
// port set explicitly by user -- he/she probably meant it!
cerr = fmt.Errorf("server startup failed: %s", err)
return
}
c.r.Println("port", currentServerPort, "already in use, attempting to use an available port")
l, sp, err := helpers.TCPListen()
if err != nil {View on GitHub ↗ (pinned to 8a468df065)
Solutions
- Remove `--appendPort=false` and let Hugo append a distinct port per language (ports increment from `--port`).
- If you need portless URLs, front the per-language ports with a reverse proxy instead of disabling appendPort.
- If multihost isn't intended, remove the per-language `baseURL` overrides so the site is single-host, then `--appendPort=false` works.
Example fix
# before hugo server --appendPort=false # multilingual site with per-language baseURLs # after hugo server # each language gets its own port
Defensive patterns
Strategy: validation
Validate before calling
if multihost && !flags.AppendPort {
return errors.New("multihost mode requires appendPort=true; remove --appendPort=false")
} Prevention
- Check whether the site config defines multiple languages with distinct baseURLs (multihost) before setting --appendPort=false
- Keep server flag overrides out of shared scripts used across single- and multihost sites
When it happens
Trigger: Running `hugo server --appendPort=false` on a site where `conf.configs.IsMultihost` is true — i.e. a multilingual config where languages define different `baseURL` values.
Common situations: Multilingual sites that set per-language baseURLs (which silently enables multihost) combined with a habit of `--appendPort=false` to get clean URLs; reverse-proxy dev setups that want portless URLs; copying server flags from a single-host project.
Related errors
- multihost change detected, please restart server
- cannot use --renderToMemory with --destination
- failed to create baseURL from %q: %s
- failed to parse root certificate
- failed to parse certificate PEM
AI-assisted analysis of gohugoio/hugo@8a468df065 (2026-07-31).
Data as JSON: /data/errors/547a11c8df0445dc.json.
Report an issue: GitHub ↗.