Skip to content

doctor: model file reported as '0.0 MB — looks truncated' for any file on x86_64 macOS #5

Description

@viirak

Environment: memxt v0.4.0, x86_64-macos (Intel Mac, macOS 26)

Symptom: memxt doctor always fails the model check, even with a valid 45.9 MB MiniLM GGUF at ~/.memxt/lib/minilm.gguf:

✗ model file at /Users/vhor/.memxt/lib/minilm.gguf is only 0.0 MB — looks truncated

The same happens with MEMXT_MODEL=/bin/ls (a 154 KB file) — reported as 0.0 MB. So fileSize() in src/doctor.zig reads st_size == 0 for every path.

Not the file: the GGUF is valid (GGUF v3 magic, 101 tensors, 45,949,216 bytes), and the embedder loads it fine — memxt embdbg prints dim=384 with real vectors. C stat() on the same path returns st_size = 45949216.

Likely cause: fileSize() (doctor.zig:69-77) calls libc stat() via @cImport struct_stat. On this x86_64 build the field read is 0, while the same layout works on Apple Silicon. v0.4.0 added Intel-Mac cross-compilation (issue #4); the x86_64 release binary appears to carry a wrong struct stat field layout (e.g. built against arm64 headers), so st_size lands on the wrong offset. fileExists() (which uses access()) works fine, which is why resolveModelPath still finds the file and the embedder still loads.

Impact: only memxt doctor diagnostics + any path that uses fileSize — memory store/search work because access() is used elsewhere. Repro:

MEMXT_MODEL=/bin/ls memxt doctor   # reports 0.0 MB for /bin/ls

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions