{"record":{"id":"1211e0aefa16e538","repo":"weaviate/weaviate","slug":"offset-parameter-must-be-a-multiple-of-the-system","errorCode":null,"errorMessage":"offset parameter must be a multiple of the system's page size","messagePattern":"offset parameter must be a multiple of the system's page size","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"usecases/mmap/mmap_unix.go","lineNumber":29,"sourceCode":"\n//go:build darwin || linux\n\npackage mmap\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"syscall\"\n\t\"unsafe\"\n\n\t\"golang.org/x/sys/unix\"\n)\n\ntype MMap []byte\n\nfunc MapRegion(f *os.File, length int, prot, flags int, offset int64) (MMap, error) {\n\tif offset%int64(os.Getpagesize()) != 0 {\n\t\treturn nil, fmt.Errorf(\"offset parameter must be a multiple of the system's page size\")\n\t}\n\n\tvar fd uintptr\n\tif flags&ANON == 0 {\n\t\tfd = uintptr(f.Fd())\n\t\tif length < 0 {\n\t\t\tfi, err := f.Stat()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tlength = int(fi.Size())\n\t\t}\n\t} else {\n\t\tif length <= 0 {\n\t\t\treturn nil, fmt.Errorf(\"anonymous mapping requires non-zero length\")\n\t\t}\n\t\tfd = ^uintptr(0)\n\t}","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/mmap/mmap_unix.go#L11-L47","documentation":"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.","triggerScenarios":"Thrown at usecases/mmap/mmap_unix.go:29 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Align the offset to os.Getpagesize() before calling MapRegion","Page-align the file region you intend to map"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}