{"record":{"id":"dad7cc02ff9f4a44","repo":"ipfs/kubo","slug":"file-does-not-support-seeking","errorCode":null,"errorMessage":"file does not support seeking","messagePattern":"file does not support seeking","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/cat.go","lineNumber":162,"sourceCode":"\t\tcase files.Directory:\n\t\t\treturn nil, 0, iface.ErrIsDir\n\t\tdefault:\n\t\t\treturn nil, 0, iface.ErrNotSupported\n\t\t}\n\n\t\tfsize, err := file.Size()\n\t\tif err != nil {\n\t\t\treturn nil, 0, err\n\t\t}\n\n\t\tif offset > fsize {\n\t\t\toffset = offset - fsize\n\t\t\tcontinue\n\t\t}\n\n\t\tseeker, ok := file.(io.Seeker)\n\t\tif !ok {\n\t\t\treturn nil, 0, fmt.Errorf(\"file does not support seeking\")\n\t\t}\n\t\tcount, err := seeker.Seek(offset, io.SeekStart)\n\t\tif err != nil {\n\t\t\treturn nil, 0, err\n\t\t}\n\t\toffset = 0\n\n\t\tfsize, err = file.Size()\n\t\tif err != nil {\n\t\t\treturn nil, 0, err\n\t\t}\n\n\t\tsize := uint64(fsize - count)\n\t\tlength += size\n\t\tif max > 0 && length >= uint64(max) {\n\t\t\tvar r io.Reader = file\n\t\t\tif overshoot := int64(length - uint64(max)); overshoot != 0 {\n\t\t\t\tr = io.LimitReader(file, int64(size)-overshoot)","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/cat.go#L144-L180","documentation":"`ipfs cat` supports an offset by seeking within the opened file. The code type-asserts the underlying reader to io.Seeker; if it does not implement it (certain DAG readers or non-seekable streams), cat returns `file does not support seeking` instead of a byte offset.","triggerScenarios":"`ipfs cat` with an offset on content whose reader does not implement io.Seeker (e.g. certain UnixFS node types or streaming readers), failing the Seek type assertion.","commonSituations":"Catting compressed/special node types or exotic DAG layouts with --offset; using the RPC API with offset on content that is streamed rather than seekable.","solutions":["Omit --offset and stream from the start, discarding bytes client-side until the desired offset","Convert the content to a standard UnixFS layout (re-add with default settings) so it is seekable","Fetch the whole file then slice locally: `ipfs get <cid>` and use dd/tail","Check the content type/DAG layout with `ipfs dag stat` or `ipfs ls`"],"exampleFix":"// before\nipfs cat $CID --offset 1000   # non-seekable reader\n// after\nipfs get $CID -o /tmp/f && dd if=/tmp/f bs=1 skip=1000","handlingStrategy":"fallback","validationCode":"null","typeGuard":"if seeker, ok := file.(io.Seeker); ok {\n    _, err := seeker.Seek(offset, io.SeekStart)\n    // seekable\n} else {\n    // fallback: read-and-discard or ipfs get then slice\n}","tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"does not support seeking\") {\n    // fallback: stream from 0 and discard offset bytes client-side\n}","preventionTips":["Avoid --offset on non-standard DAG layouts; verify layout with `ipfs dag stat`","Prefer `ipfs get` + local slicing for exotic content","Use default UnixFS add settings when seekability matters","Test offset reads against your content types before production"],"tags":["cli","cat","unixfs","seek"],"backgroundTag":"seek-not-supported","analyzedSha":"329838acdfafae224582930457efe80aa217afc0","analyzedAt":"2026-09-03T18:30:52.135Z","contentChangedAt":"2026-09-03T18:30:52.135Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}