{"id":"3f03c40c102ebdce","repo":"gohugoio/hugo","slug":"timed-out-rendering-the-page-content-extend-the","errorCode":null,"errorMessage":"timed out rendering the page content. Extend the `timeout` limit in your Hugo config file: %w","messagePattern":"timed out rendering the page content\\. Extend the `timeout` limit in your Hugo config file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hugolib/page__content.go","lineNumber":825,"sourceCode":"\n\t\t// TODO(bep) is set in a test. Fix that.\n\t\tif result.fuzzyWordCount == 0 {\n\t\t\tresult.fuzzyWordCount = (result.wordCount + 100) / 100 * 100\n\t\t}\n\n\t\tif isCJKLanguage {\n\t\t\tresult.readingTime = (result.wordCount + 500) / 501\n\t\t} else {\n\t\t\tresult.readingTime = (result.wordCount + 212) / 213\n\t\t}\n\n\t\trs.Value = result\n\n\t\treturn rs, nil\n\t})\n\tif err != nil {\n\t\tif herrors.IsTimeoutError(err) {\n\t\t\terr = fmt.Errorf(\"timed out rendering the page content. Extend the `timeout` limit in your Hugo config file: %w\", err)\n\t\t}\n\t\treturn contentPlainPlainWords{}, err\n\t}\n\treturn v.Value, nil\n}\n\ntype cachedContentScope struct {\n\t*cachedContent\n\tpco   *pageContentOutput\n\tscope string\n}\n\nfunc (c *cachedContentScope) prepareContext(ctx context.Context) context.Context {\n\t// A regular page's shortcode etc. may be rendered by e.g. the home page,\n\t// so we need to track any changes to this content's page.\n\tctx = tpl.Context.DependencyManagerScopedProvider.Set(ctx, c.pco.po.p)\n\n\t// The markup scope is recursive, so if already set to a non zero value, preserve that value.","sourceCodeStart":807,"sourceCodeEnd":843,"githubUrl":"https://github.com/gohugoio/hugo/blob/8a468df065a75c1c7cf9f6850f32148746590ea5/hugolib/page__content.go#L807-L843","documentation":"Returned from the plain-content computation in page__content.go when rendering a page's content exceeds Hugo's configured build timeout; herrors.IsTimeoutError detects the context timeout and Hugo wraps it with a hint to raise the `timeout` config value (default 30s or 60s depending on version). It exists because content rendering is guarded by a deadline to catch template deadlocks and runaway work.","triggerScenarios":"A page whose content rendering takes longer than `timeout`: huge markdown files, expensive shortcodes (resources.GetRemote, image processing of many/large images), or — very commonly — recursive template loops such as a shortcode or render hook calling .Page.Content on the same page, which deadlocks until the timeout fires.","commonSituations":"Sites with thousands of images processed in shortcodes; slow remote data/resource fetches during render; a partial or render-hook that references .Summary/.Content of the page currently rendering (self-reference deadlock); underpowered CI runners where builds are simply slower.","solutions":["First check for self-reference: search layouts for shortcodes/partials/render hooks calling .Page.Content, .Summary, or .WordCount on the page being rendered — that's a deadlock, and raising the timeout won't fix it.","If work is genuinely heavy, raise the limit in hugo.toml: `timeout = '120s'`.","Cache expensive operations: use partialCached, cache remote resources, and pre-process images so repeated builds hit resources/_gen.","On CI, persist the resources/ and cache directories between builds so image processing isn't repeated."],"exampleFix":"# hugo.toml before\n# (no timeout set — 30s default)\n# after\ntimeout = '120s'","handlingStrategy":"retry","validationCode":"# hugo.toml — size the limit to the heaviest page\ntimeout = '120s'","typeGuard":null,"tryCatchPattern":"if err := h.Build(cfg); err != nil {\n    if strings.Contains(err.Error(), \"timed out rendering\") {\n        // raise `timeout` in config or break the recursion, then rebuild\n    }\n    return err\n}","preventionTips":["Set `timeout` explicitly for large sites; default 30s can be tight","A timeout often masks infinite recursion (partial rendering itself, .Content in shortcode of same page) — check for cycles first","Cache expensive partials with partialCached","Profile slow pages with `hugo --templateMetrics`"],"tags":["hugo","timeout","configuration","performance","rendering"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}