Skip to content

Windows: dense-only vindex fails to load (mmap of zero-length file, error 87) #164

Description

@chrishayuk

Summary

The dense-only vindex load path fails on Windows only (ubuntu + macos are green). Introduced by #159 (BitNet --dense-only build/load).

test extract::build::tests::dense_only_vindex_loads_without_gate_vectors ... FAILED
thread '...' panicked at crates\larql-vindex\src\extract\build\mod.rs:568:
  dense-only vindex failed to load: Some(Io(Os { code: 87, kind: InvalidInput,
  message: "The parameter is incorrect." }))

Root cause

Windows error 87 (ERROR_INVALID_PARAMETER) is the classic symptom of memmap2::Mmap::map on a 0-byte file: CreateFileMapping rejects a zero size on Windows, whereas Linux/macOS map an empty file fine. The dense-only build skips gate_vectors.bin (and the load path mmaps gate/weight files unconditionally), so a zero-length / empty file reaches an unguarded Mmap::map.

Likely site: crates/larql-vindex/src/format/weights/load/f32.rs (the gate_vectors.bin mmap around the config.quant == None && !opts.skip_ffn branch), but every load-path Mmap::map should be audited — there are several (embeddings.rs, f32.rs).

Suggested fix

Guard the load-path mmaps against zero-length files — skip the mmap (treat as absent / empty) when file.metadata()?.len() == 0. This is correct cross-platform (a 0-byte mapping has no data anyway) and matches how dense-only intentionally omits gate vectors.

Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions