{"record":{"id":"3b1889f9c9bd7925","repo":"stride3d/stride","slug":"unable-to-find-the-file-url","errorCode":null,"errorMessage":"Unable to find the file [{url}]","messagePattern":"Unable to find the file \\[(.+?)\\]","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Serialization/IO/DatabaseFileProvider.cs","lineNumber":61,"sourceCode":"    public IContentIndexMap ContentIndexMap { get; }\n\n    public ObjectDatabase ObjectDatabase { get; }\n\n    /// <inheritdoc/>\n    public override Stream OpenStream(string url, VirtualFileMode mode, VirtualFileAccess access, VirtualFileShare share = VirtualFileShare.Read, StreamFlags streamFlags = StreamFlags.None)\n    {\n        // Open or create the file through the underlying (IContentIndexMap, IOdbBackend) couple.\n        // Also read/write a ObjectHeader.\n        if (mode == VirtualFileMode.Open)\n        {\n            ObjectId objectId;\n            if (url.StartsWith(ObjectIdUrl, StringComparison.Ordinal))\n            {\n                _ = ObjectId.TryParse(url[ObjectIdUrl.Length..], out objectId);\n            }\n            else if (!TryGetObjectId(url, out objectId))\n            {\n                throw new FileNotFoundException($\"Unable to find the file [{url}]\");\n            }\n\n            var result = ObjectDatabase.OpenStream(objectId, mode, access, share);\n\n            // copy the stream into a memory stream in order to make it seek-able\n            if (streamFlags == StreamFlags.Seekable && !result.CanSeek)\n            {\n                var buffer = new byte[result.Length - result.Position];\n                result.ReadExactly(buffer, 0, buffer.Length);\n                return new DatabaseReadFileStream(objectId, new MemoryStream(buffer), 0);\n            }\n\n            return new DatabaseReadFileStream(objectId, result, result.Position);\n        }\n\n        if (mode == VirtualFileMode.Create)\n        {\n            if (url.StartsWith(ObjectIdUrl, StringComparison.Ordinal))","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Serialization/IO/DatabaseFileProvider.cs#L43-L79","documentation":"DatabaseFileProvider.OpenStream resolves a URL to an ObjectId via the object database's index map before opening the stream. When the URL cannot be parsed as an ObjectId reference and TryGetObjectId cannot find it in the index, a FileNotFoundException is thrown, indicating the file is not present in the mounted asset database.","triggerScenarios":"Opening a stream for a URL that was never written to the database, a misspelled/renamed asset URL, or a URL whose entry is missing from the index map (e.g. stale or truncated index file).","commonSituations":"Requesting assets deleted from the asset store; case/path mismatches between recorded and requested URLs; corrupted index files after a crash; code built against one database opened with another.","solutions":["Verify the URL exists in the index (e.g. via IContentIndexMap / TryGetObjectId) before opening","Check the URL spelling and that the correct database/mount path is used","Rebuild or re-save the asset index if it is stale or truncated","Re-add the missing asset to the object database"],"exampleFix":"// before\nusing var s = provider.OpenStream(url, StreamMode.Read, StreamFlags.Seekable);\n// after\nif (((IContentIndexMap)indexMap).TryGetValue(url, out _))\n    using var s = provider.OpenStream(url, StreamMode.Read, StreamFlags.Seekable);\nelse\n    Log.Warning($\"Asset '{url}' not found in database\");","handlingStrategy":"try-catch","validationCode":"bool Exists(IContentIndexMap map, string url) =>\n    map.TryGetValue(url, out _);","typeGuard":null,"tryCatchPattern":"try\n{\n    using var stream = provider.OpenStream(url, StreamMode.Read, StreamFlags.Seekable);\n    // use stream\n}\ncatch (FileNotFoundException)\n{\n    Log.Warning($\"Asset '{url}' missing from database\");\n}","preventionTips":["Validate URLs against the content index before opening","Use consistent casing and paths when writing/reading URLs","Rebuild index files after crashes; keep backups","Ensure the intended database is mounted before loading assets"],"tags":["io","file-not-found","asset-database"],"backgroundTag":"file-not-found","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}