{"id":"547a11c8df0445dc","repo":"gohugoio/hugo","slug":"appendport-false-not-supported-when-in-multihost","errorCode":null,"errorMessage":"--appendPort=false not supported when in multihost mode","messagePattern":"--appendPort=false not supported when in multihost mode","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"commands/server.go","lineNumber":761,"sourceCode":"\t\tRoots:   roots,\n\t}\n\n\tif _, err := cert.Verify(opts); err != nil {\n\t\treturn fmt.Errorf(\"failed to verify certificate: %v\", err.Error())\n\t}\n\n\treturn nil\n}\n\nfunc (c *serverCommand) createServerPorts(cd *simplecobra.Commandeer) error {\n\tflags := cd.CobraCommand.Flags()\n\tvar cerr error\n\tc.withConf(func(conf *commonConfig) {\n\t\tisMultihost := conf.configs.IsMultihost\n\t\tc.serverPorts = make([]serverPortListener, 1)\n\t\tif isMultihost {\n\t\t\tif !c.serverAppend {\n\t\t\t\tcerr = errors.New(\"--appendPort=false not supported when in multihost mode\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tc.serverPorts = make([]serverPortListener, len(conf.configs.Languages))\n\t\t}\n\t\tcurrentServerPort := c.serverPort\n\t\tfor i := range c.serverPorts {\n\t\t\tl, err := net.Listen(\"tcp\", net.JoinHostPort(c.serverInterface, strconv.Itoa(currentServerPort)))\n\t\t\tif err == nil {\n\t\t\t\tc.serverPorts[i] = serverPortListener{ln: l, p: currentServerPort}\n\t\t\t} else {\n\t\t\t\tif i == 0 && flags.Changed(\"port\") {\n\t\t\t\t\t// port set explicitly by user -- he/she probably meant it!\n\t\t\t\t\tcerr = fmt.Errorf(\"server startup failed: %s\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tc.r.Println(\"port\", currentServerPort, \"already in use, attempting to use an available port\")\n\t\t\t\tl, sp, err := helpers.TCPListen()\n\t\t\t\tif err != nil {","sourceCodeStart":743,"sourceCodeEnd":779,"githubUrl":"https://github.com/gohugoio/hugo/blob/8a468df065a75c1c7cf9f6850f32148746590ea5/commands/server.go#L743-L779","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nhugo server --appendPort=false   # multilingual site with per-language baseURLs\n# after\nhugo server                      # each language gets its own port","handlingStrategy":"validation","validationCode":"if multihost && !flags.AppendPort {\n    return errors.New(\"multihost mode requires appendPort=true; remove --appendPort=false\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["hugo-server","multihost","multilingual","cli-flags"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}