{"record":{"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/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/resources/resource_factories/bundler/bundler.go#L107-L143","documentation":"Returned by `bundler.Client.Concat` (bundler.go:120-126) when a resource in the input list does not implement `resource.ReadSeekCloserResource`. Concat needs to open each source as a `ReadSeekCloser` to stream bytes; resources that are pure metadata, page-less, or remote-without-seek cannot be concatenated. The type assertion at bundler.go:123-125 fails.","triggerScenarios":"Passing into `resources.Concat` a resource that is not a readable/seekable source -- e.g. a remote Resource created with method `HEAD` (no body), a Resource that wraps only metadata, a stub used for identity, or a third-party Resource type missing the `ReadSeekCloser()` method.","commonSituations":"Bundling remote resources fetched via `resources.GetRemote` with `method=HEAD`; mixing in resources produced by `resources.FromString` after they've been transformed to a non-seekable wrapper; custom Resource implementations registered by themes/plugins that skip the ReadSeekCloser interface; bugs where a transformed resource loses its reader capability.","solutions":["Filter the list to resources known to be readable (local file resources, `resources.FromString` outputs that are still seekable).","For remote resources, fetch with GET (default) so the body is available for re-reading.","If using a custom Resource type, implement `ReadSeekCloser() (hugio.ReadSeekCloser, error)`.","Replace non-readable entries with a readable equivalent (e.g. re-fetch remote with GET)."],"exampleFix":"// template -- before\n{{ $bundle := resources.Concat \"out.js\" (slice $headOnlyRemote $localJS) }}\n\n// after\n{{ $remote := resources.GetRemote \"https://example.com/app.js\" (dict \"method\" \"GET\") }}\n{{ $bundle := resources.Concat \"out.js\" (slice $remote $localJS) }}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"func isReadable(v any) bool {\n\t_, ok := v.(resource.ReadSeekCloserResource)\n\treturn ok\n}","tryCatchPattern":null,"preventionTips":["Only concat resources that have a readable body (local files, GET-fetched remotes, FromString outputs).","Avoid HEAD-fetched remote resources in bundles.","Implement `ReadSeekCloser()` on custom Resource types."],"tags":["resources","bundler","concat","interfaces","type-mismatch"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}