{"record":{"id":"15b40a0c26ae0119","repo":"ollama/ollama","slug":"s-seek-failed-path-s-offset-zu-size-zu-errno","errorCode":null,"errorMessage":"%s: seek failed path=%s offset=%zu size=%zu errno=%d (%s)\\n","messagePattern":"(.+?): seek failed path=(.+?) offset=%zu size=%zu errno=(.+?) \\((.+?)\\)\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"llama/compat/llama-ollama-compat-util.cpp","lineNumber":292,"sourceCode":"    return true;\n}\n\nbool read_at(const char * path, size_t offset, void * dst, size_t size) {\n    FILE * f = ggml_fopen(path, \"rb\");\n    if (!f) {\n        std::fprintf(stderr, \"%s: open failed path=%s offset=%zu size=%zu errno=%d (%s)\\n\",\n                     __func__, path, offset, size, errno, std::strerror(errno));\n        return false;\n    }\n\n    errno = 0;\n#if defined(_WIN32)\n    const int seek_rc = _fseeki64(f, static_cast<__int64>(offset), SEEK_SET);\n#else\n    const int seek_rc = fseeko(f, static_cast<off_t>(offset), SEEK_SET);\n#endif\n    if (seek_rc != 0) {\n        std::fprintf(stderr, \"%s: seek failed path=%s offset=%zu size=%zu errno=%d (%s)\\n\",\n                     __func__, path, offset, size, errno, std::strerror(errno));\n        std::fclose(f);\n        return false;\n    }\n\n    const size_t n = std::fread(dst, 1, size, f);\n    const bool ok = n == size;\n    if (!ok) {\n        std::fprintf(stderr, \"%s: read failed path=%s offset=%zu size=%zu got=%zu errno=%d (%s) ferror=%d\\n\",\n                     __func__, path, offset, size, n, errno, std::strerror(errno), std::ferror(f));\n    }\n    std::fclose(f);\n    return ok;\n}\n\n// -------------------------------------------------------------------------\n// Common high-level transforms\n// -------------------------------------------------------------------------","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/ollama/ollama/blob/e5a81899d014a847a08d47393351908b53d74008/llama/compat/llama-ollama-compat-util.cpp#L274-L310","documentation":"Logged to stderr by read_at() when fseeko (or _fseeki64 on Windows) fails after the GGUF blob file was successfully opened. The offset/size/errno are printed and read_at returns false. Seek failures mean the file handle is valid but the read position could not be moved — almost always a large-file (>2GiB) support problem or a truncated/irregular file.","triggerScenarios":" offsets beyond 2GiB on platforms/builds without _FILE_OFFSET_BITS=64 (EFBIG/EOVERFLOW-style failures); EFAULT/ESPIPE on exotic filesystems that don't support arbitrary seeks (some FUSE mounts, pipes if a path resolved oddly); file truncated on disk (sparse file collapse, disk filling tool, snapshot rollback) making the offset invalid; interrupted system call (EINTR-class) under heavy load.","commonSituations":"Large multi-GB models on 32-bit builds or non-standard filesystems; VM/container overlays with flaky large-file support; storage that silently truncates files (full disks with sparse handling); models on NFS/FUSE mounts under load.","solutions":["Check errno in the message and the filesystem type hosting OLLAMA_MODELS","Move models to a native local filesystem (ext4/APFS/NTFS) if on NFS/FUSE","Verify the file is not truncated: compare its size to the digest in the manifest ('ollama show <model>') and re-pull if short","Rebuild with 64-bit file offsets (ensure _FILE_OFFSET_BITS=64 / 64-bit build) if offsets exceed 2GiB","Retry after remounting/repairing the volume if errno indicates a transient FS fault"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before serving a model: sanity-check blob size against manifest digest\nfi, _ := os.Stat(blobPath);\nif expected > 0 && fi != nil && fi.Size() < expected { return fmt.Errorf(\"truncated blob: %d < %d\", fi.Size(), expected) }","typeGuard":null,"tryCatchPattern":"if (!read_at(path, offset, dst, size)) {\n    // differentiate seek vs read via the logged message; abort load with a clear error\n    return false; // propagate to GGUF loader as tensor-read failure\n}","preventionTips":["Keep models on native local filesystems; avoid NFS/FUSE for >2GiB blobs","Build 64-bit with _FILE_OFFSET_BITS=64 for large-offset seeks","Repair storage (fsck/disk utility) when EIO/ESPIPE errno values appear","Keep free disk headroom so writes are never truncated mid-pull"],"tags":["cpp","filesystem","models","gguf","large-files"],"backgroundTag":null,"analyzedSha":"e5a81899d014a847a08d47393351908b53d74008","analyzedAt":"2026-08-15T05:34:15.336Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}