weaviate/weaviate · error

offset parameter must be a multiple of the system's page siz

Error message

offset parameter must be a multiple of the system's page size

What it means

MapRegion guard: the mmap offset must be page-aligned for mmap(2) to accept it. The caller passed an offset that is not a multiple of os.Getpagesize(), so the mapping request is rejected before any syscall is made.

Source

Thrown at usecases/mmap/mmap_unix.go:29

//go:build darwin || linux

package mmap

import (
	"fmt"
	"os"
	"syscall"
	"unsafe"

	"golang.org/x/sys/unix"
)

type MMap []byte

func MapRegion(f *os.File, length int, prot, flags int, offset int64) (MMap, error) {
	if offset%int64(os.Getpagesize()) != 0 {
		return nil, fmt.Errorf("offset parameter must be a multiple of the system's page size")
	}

	var fd uintptr
	if flags&ANON == 0 {
		fd = uintptr(f.Fd())
		if length < 0 {
			fi, err := f.Stat()
			if err != nil {
				return nil, err
			}
			length = int(fi.Size())
		}
	} else {
		if length <= 0 {
			return nil, fmt.Errorf("anonymous mapping requires non-zero length")
		}
		fd = ^uintptr(0)
	}

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Align the offset to os.Getpagesize() before calling MapRegion
  2. Page-align the file region you intend to map
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at usecases/mmap/mmap_unix.go:29 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04). Data as JSON: /api/errors/1211e0aefa16e538. Report an issue: GitHub.