{"id":"6577fc45d50834aa","repo":"gohugoio/hugo","slug":"failed-to-parse-timeout-s","errorCode":null,"errorMessage":"failed to parse timeout: %s","messagePattern":"failed to parse timeout: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/allconfig/allconfig.go","lineNumber":279,"sourceCode":"\tx.StaticDir6 = nil\n\tx.StaticDir7 = nil\n\tx.StaticDir8 = nil\n\tx.StaticDir9 = nil\n\tx.StaticDir10 = nil\n\n\treturn &x\n}\n\nfunc (c *Config) CompileConfig(logger loggers.Logger) error {\n\tvar transientErr error\n\ts := c.Timeout\n\tif _, err := strconv.Atoi(s); err == nil {\n\t\t// A number, assume seconds.\n\t\ts = s + \"s\"\n\t}\n\ttimeout, err := time.ParseDuration(s)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to parse timeout: %s\", err)\n\t}\n\tdisabledKinds := make(map[string]bool)\n\tfor _, kind := range c.DisableKinds {\n\t\tkind = strings.ToLower(kind)\n\t\tif newKind := kinds.IsDeprecatedAndReplacedWith(kind); newKind != \"\" {\n\t\t\tlogger.Deprecatef(false, \"Kind %q used in disableKinds is deprecated, use %q instead.\", kind, newKind)\n\t\t\t// Legacy config.\n\t\t\tkind = newKind\n\t\t}\n\t\tif kinds.GetKindAny(kind) == \"\" {\n\t\t\tlogger.Warnf(\"Unknown kind %q in disableKinds configuration.\", kind)\n\t\t\tcontinue\n\t\t}\n\t\tdisabledKinds[kind] = true\n\t}\n\tkindOutputFormats := make(map[string]output.Formats)\n\tisRssDisabled := disabledKinds[\"rss\"]\n\toutputFormats := c.OutputFormats.Config","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/gohugoio/hugo/blob/8a468df065a75c1c7cf9f6850f32148746590ea5/config/allconfig/allconfig.go#L261-L297","documentation":"During `Config.CompileConfig`, Hugo parses the `timeout` setting. A bare integer is treated as seconds (it appends \"s\"), otherwise the value must be a valid Go `time.ParseDuration` string like \"30s\" or \"2m\". Anything else fails compilation with this error.","triggerScenarios":"A `timeout` value in site config that is neither an integer nor a valid duration string — e.g. `timeout = \"30 seconds\"`, `timeout = \"1h30\"`, or a float like `\"2.5\"` without a unit suffix.","commonSituations":"Users writing human-style durations (\"1 minute\"), copying values from other tools, or old configs using milliseconds-as-number assumptions; note plain numbers were interpreted as milliseconds before Hugo 0.86 and as seconds after.","solutions":["Use a Go duration string: `timeout = \"60s\"`, `\"2m\"`, `\"1h\"`.","Or use a plain integer, which Hugo interprets as seconds: `timeout = 120`.","Check theme/module configs too — the merged value may come from a dependency (`hugo config | grep -i timeout`)."],"exampleFix":"# before (hugo.toml)\ntimeout = \"30 seconds\"\n# after\ntimeout = \"30s\"","handlingStrategy":"validation","validationCode":"if _, err := time.ParseDuration(timeoutStr); err != nil {\n    if _, err2 := strconv.Atoi(timeoutStr); err2 != nil {\n        return fmt.Errorf(\"invalid timeout %q: use a Go duration like \\\"30s\\\"\", timeoutStr)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set timeout as a Go duration string (\"30s\", \"2m\") or plain milliseconds integer","Validate user-supplied config values with time.ParseDuration before writing them into the config map","Avoid units like \"30 sec\" or locale-formatted numbers"],"tags":["hugo","config","duration-parsing","go"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}