{"id":"1fcab7535bfe0fb3","repo":"gohugoio/hugo","slug":"resource-t-does-not-implement-resource-readseeker","errorCode":null,"errorMessage":"resource %T does not implement resource.ReadSeekerCloserResource","messagePattern":"resource %T does not implement resource\\.ReadSeekerCloserResource","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"resources/resource_factories/bundler/bundler.go","lineNumber":125,"sourceCode":"\t\t\t\tfor _, rr := range r {\n\t\t\t\t\tidentity.WalkIdentitiesShallow(rr, func(depth int, id identity.Identity) bool {\n\t\t\t\t\t\tterminate = f(id)\n\t\t\t\t\t\treturn terminate\n\t\t\t\t\t})\n\t\t\t\t\tif terminate {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn terminate\n\t\t\t},\n\t\t))\n\n\t\tconcatr := func() (hugio.ReadSeekCloser, error) {\n\t\t\tvar rcsources []hugio.ReadSeekCloser\n\t\t\tfor _, s := range r {\n\t\t\t\trcr, ok := s.(resource.ReadSeekCloserResource)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"resource %T does not implement resource.ReadSeekerCloserResource\", s)\n\t\t\t\t}\n\t\t\t\trc, err := rcr.ReadSeekCloser()\n\t\t\t\tif err != nil {\n\t\t\t\t\t// Close the already opened.\n\t\t\t\t\tfor _, rcs := range rcsources {\n\t\t\t\t\t\trcs.Close()\n\t\t\t\t\t}\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\trcsources = append(rcsources, rc)\n\t\t\t}\n\n\t\t\t// Arbitrary JavaScript files require a barrier between them to be safely concatenated together.\n\t\t\t// Without this, the last line of one file can affect the first line of the next file and change how both files are interpreted.\n\t\t\tif resolvedm.MainType == media.Builtin.JavascriptType.MainType && resolvedm.SubType == media.Builtin.JavascriptType.SubType {\n\t\t\t\treaders := make([]hugio.ReadSeekCloser, 2*len(rcsources)-1)\n\t\t\t\tj := 0","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/gohugoio/hugo/blob/8a468df065a75c1c7cf9f6850f32148746590ea5/resources/resource_factories/bundler/bundler.go#L107-L143","documentation":"When Concat lazily opens its inputs, each resource must implement `resource.ReadSeekCloserResource` so its content can be read (and re-read on rebuilds). A resource type that cannot provide a seekable reader — typically a synthetic or wrapper resource that doesn't expose raw content this way — fails this type assertion. The `%T` in the message shows the concrete Go type that lacked the interface.","triggerScenarios":"Passing a resource into `resources.Concat` whose concrete type does not implement `ReadSeekCloser()` — e.g. certain lazily-evaluated or error-wrapping resources, resources produced by a transformation that only supports streaming, or objects that are Resources but not content-backed (like some Page-derived values) placed into the slice.","commonSituations":"Building the Concat slice from mixed template values (accidentally including a Page or params object cast as a resource), using output from a custom/un上游 transformation that broke the interface after a Hugo upgrade, or a plugin/module returning a wrapper resource type.","solutions":["Inspect what you put in the slice — ensure every element comes from `resources.Get`/`resources.GetMatch`/standard pipes, not from Pages or other non-content values.","Materialize the resource first (e.g. pipe through `minify`/`fingerprint` or access `.Content`) so a concrete content-backed resource is produced before Concat.","If it appeared after upgrading Hugo or a module, pin/upgrade the module and report the resource type shown in `%T` upstream."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// Go API callers: verify the resource supports seeking before bundling\nfunc canConcat(r resource.Resource) bool {\n    _, ok := r.(resource.ReadSeekerCloserResource)\n    return ok\n}","tryCatchPattern":null,"preventionTips":["Pass only file-backed resources (resources.Get, resources.GetMatch) to Concat","Avoid piping exotic/dynamically-generated resource types into Concat; materialize them first (e.g. resources.FromString) so they're seekable","When extending Hugo, implement ReadSeekCloser() on custom resource types destined for bundling"],"tags":["hugo","concat","interface-assertion","resources"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}