kernel-memory icon indicating copy to clipboard operation
kernel-memory copied to clipboard

[Bug]: Unhandled exception. System.Text.Json.JsonException: '0x00' is an invalid start of a value

Open biapar opened this issue 1 year ago • 2 comments

Context / Scenario

I use LLAMASharp + KernelMemory with PDF analysis. I try with a long PDF. When I query the model, I've this error. I import the docs with:

 await memory.ImportDocumentAsync(documentPaths[I],
                    steps: Constants.PipelineWithoutSummary);

  SimpleFileStorageConfig storageConfig = new()
                                                {
                                                    Directory = StorageFolder,
                                                    StorageType = FileSystemTypes.Disk,
                                                };

        
        SimpleVectorDbConfig vectorDbConfig = new()
                                              {
                                                  Directory = StorageFolder,
                                                  StorageType = FileSystemTypes.Disk,
                                              };

What happened?

After a prompt:

Error on JSON Read: Unhandled exception. System.Text.Json.JsonException: '0x00' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0. ---> System.Text.Json.JsonReaderException: '0x00' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0. at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan1 bytes) at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker) at System.Text.Json.Utf8JsonReader.ReadFirstToken(Byte first) at System.Text.Json.Utf8JsonReader.ReadSingleSegment() at System.Text.Json.Utf8JsonReader.Read() at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) --- End of inner exception stack trace --- at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex) at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.Serialization.Metadata.JsonTypeInfo1.Deserialize(Utf8JsonReader& reader, ReadStack& state) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 utf8Json, JsonTypeInfo1 jsonTypeInfo, Nullable1 actualByteCount) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 json, JsonTypeInfo1 jsonTypeInfo) at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options) at Microsoft.KernelMemory.MemoryStorage.DevTools.SimpleVectorDb.GetListAsync(String index, ICollection1 filters, Int32 limit, Boolean withEmbeddings, CancellationToken cancellationToken)+MoveNext() at Microsoft.KernelMemory.MemoryStorage.DevTools.SimpleVectorDb.GetListAsync(String index, ICollection1 filters, Int32 limit, Boolean withEmbeddings, CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult() at Microsoft.KernelMemory.MemoryStorage.DevTools.SimpleVectorDb.GetSimilarListAsync(String index, String text, ICollection1 filters, Double minRelevance, Int32 limit, Boolean withEmbeddings, CancellationToken cancellationToken)+MoveNext() at Microsoft.KernelMemory.MemoryStorage.DevTools.SimpleVectorDb.GetSimilarListAsync(String index, String text, ICollection1 filters, Double minRelevance, Int32 limit, Boolean withEmbeddings, CancellationToken cancellationToken)+MoveNext() at Microsoft.KernelMemory.MemoryStorage.DevTools.SimpleVectorDb.GetSimilarListAsync(String index, String text, ICollection1 filters, Double minRelevance, Int32 limit, Boolean withEmbeddings, CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult() at Microsoft.KernelMemory.Search.SearchClient.AskAsync(String index, String question, ICollection1 filters, Double minRelevance, IContext context, CancellationToken cancellationToken) at Microsoft.KernelMemory.Search.SearchClient.AskAsync(String index, String question, ICollection1 filters, Double minRelevance, IContext context, CancellationToken cancellationToken) at Program.ShowAnswer(IKernelMemory memory, String question) in /Users/biagioparuolo/ProjectsOnMac/_BWare360Projects/LLMSharp/LLMSharpDemo/LLMSharpDemo/Program.cs:line 145 at Program.StartUserChatSession(IKernelMemory memory) in /Users/biagioparuolo/ProjectsOnMac/_BWare360Projects/LLMSharp/LLMSharpDemo/LLMSharpDemo/Program.cs:line 251 at Program.Main(String[] args) in /Users/biagioparuolo/ProjectsOnMac/_BWare360Projects/LLMSharp/LLMSharpDemo/LLMSharpDemo/Program.cs:line 132 at Program.<Main>(String[] args) [1] 11122 abort

Importance

edge case

Platform, Language, Versions

LLAMASharp last ver Kernel Memory last ver .NET Core 8 MacOS

Relevant log output


biapar avatar Dec 02 '24 07:12 biapar