diff --git a/LLama/Native/SafeLlamaModelHandle.cs b/LLama/Native/SafeLlamaModelHandle.cs index 66f25bb36..4e49a34fc 100644 --- a/LLama/Native/SafeLlamaModelHandle.cs +++ b/LLama/Native/SafeLlamaModelHandle.cs @@ -129,7 +129,7 @@ public static SafeLlamaModelHandle LoadFromFile(string modelPath, LLamaModelPara // - File exists (automatically throws FileNotFoundException) // - File is readable (explicit check) // This provides better error messages that llama.cpp, which would throw an access violation exception in both cases. - using (var fs = new FileStream(modelPath, FileMode.Open)) + using (var fs = new FileStream(modelPath, FileMode.Open, FileAccess.Read)) if (!fs.CanRead) throw new InvalidOperationException($"Model file '{modelPath}' is not readable");