{"record":{"id":"00fc84db427126c1","repo":"stride3d/stride","slug":"no-active-stream","errorCode":null,"errorMessage":"No active stream.","messagePattern":"No active stream\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Serialization/IO/Store.cs","lineNumber":155,"sourceCode":"\n                // Use unsavedIdMap so that loadedIdMap is still coherent before flushed to disk asynchronously (since other processes/threads might write to it as well).\n                AddUnsaved(item, currentTransaction);\n\n                if (shouldSaveValue)\n                    SaveValue(item, currentTransaction);\n            }\n        }\n        finally\n        {\n            if (shouldSaveValue)\n                Monitor.Exit(stream);\n        }\n    }\n\n    private void SaveValues(IEnumerable<T> values, int currentTransaction)\n    {\n        if (stream == null)\n            throw new InvalidOperationException(\"No active stream.\");\n\n        lock (stream)\n        {\n            var indexStreamPosition = stream.Position;\n\n            // Acquire lock on end of file (for appending)\n            // This will prevent another thread from writing at the same time, or reading before it is flushed.\n            if (LockEnabled && stream is FileStream fileStream)\n            {\n                LockFile(fileStream, indexStreamPosition, long.MaxValue - indexStreamPosition, true);\n            }\n\n            try\n            {\n                // Make sure we read up entries up to end of file (or skip it if AutoLoadNewValues is not set)\n                if (AutoLoadNewValues)\n                    RefreshData(stream.Length);\n                else","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Serialization/IO/Store.cs#L137-L173","documentation":"Store<T> persists key/value mappings into an index stream that must first be attached (typically via Open/constructor binding). SaveValues is the internal writer used by AddValues/Save; if the underlying stream is null there is nothing to write to, so it throws InvalidOperationException.","triggerScenarios":"Calling AddValues(...) or otherwise triggering SaveValues before the store was opened/bound to a stream, or after Close() disposed the stream.","commonSituations":"Using a Store instance constructed manually without opening it; calling Save-related methods after disposing; failure to check that the database file was successfully opened at startup.","solutions":["Open/initialize the Store (attach its stream) before calling AddValues/Save","Ensure Close/Dispose is not called before all pending AddValues calls complete","Wrap store lifecycle in using/try-finally so usage never outlives the stream"],"exampleFix":"// before\nvar store = new Store<string, ObjectId>(...);\nstore.AddValue(\"url\", id);\n// after\nvar store = new Store<string, ObjectId>(...);\nstore.Open();\nstore.AddValue(\"url\", id);","handlingStrategy":"validation","validationCode":"if (storeIsOpen) // e.g. track via your own flag after Open()\n    store.AddValues(values);\nelse\n    throw new InvalidOperationException(\"Store must be opened before AddValues\");","typeGuard":null,"tryCatchPattern":"try { store.AddValues(values); }\ncatch (InvalidOperationException ex) when (ex.Message == \"No active stream.\")\n{\n    // open store and retry, or fail startup\n}","preventionTips":["Always pair Store construction with an Open call","Use using/try-finally so Close happens exactly once, after all writes","Fail fast at startup if the store failed to open"],"tags":["io","state","store"],"backgroundTag":"invalid-state-transition","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}