{"record":{"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":"exception","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/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/config/allconfig/allconfig.go#L261-L297","documentation":"Returned by Config.CompileConfig when the `timeout` config string cannot be parsed as a Go duration. The code first tries strconv.Atoi: if it succeeds, the number is treated as seconds and 's' is appended; otherwise it calls time.ParseDuration directly. Failure of that final parse yields this error wrapping the parse error.","triggerScenarios":"Setting `timeout` in hugo.toml/yaml/json to a value that is neither a bare integer (seconds) nor a valid Go duration string (e.g. '30', '2m', '1h30m').","commonSituations":"Porting configs from other tools that accept human durations like '1 day' or '1d', or typos like '30sec', '5 mins', 'fast'.","solutions":["Use a plain integer (interpreted as seconds) e.g. `timeout = 60`.","Or use Go duration syntax e.g. `timeout = \"45s\"`, `timeout = \"5m\"`.","Remove invalid unit words like 'sec', 'min', 'day'."],"exampleFix":"// before\ntimeout = \"30sec\"\n// after\ntimeout = \"30s\"","handlingStrategy":"validation","validationCode":"func validateTimeout(s string) error {\n  if _, err := strconv.Atoi(s); err == nil { return nil }\n  if _, err := time.ParseDuration(s); err == nil { return nil }\n  return fmt.Errorf(\"invalid timeout %q: use integer seconds or Go duration\", s)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer integer seconds or Go duration strings for `timeout`.","Add a CI lint that runs validateTimeout on the config.","Avoid locale-specific unit words (sec/min/day)."],"tags":["config","timeout","duration","allconfig"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}