{"record":{"id":"f9756a0b8b497c54","repo":"LykosAI/StabilityMatrix","slug":"uri-has-unsupported-scheme-uri-source","errorCode":null,"errorMessage":"Uri has unsupported scheme. Uri:{source}","messagePattern":"Uri has unsupported scheme\\. Uri:(.+?)","errorType":"exception","errorClass":"UriFormatException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Avalonia/Controls/VendorLabs/AsyncImage/BetterAsyncImage.cs","lineNumber":172,"sourceCode":"\n                    if (uri.Scheme == \"file\" && File.Exists(uri.LocalPath))\n                    {\n                        if (!IsCacheEnabled)\n                        {\n                            return decodeWidth > 0\n                                ? SkiaExtensions.DecodeFileToAvaloniaImageScaled(uri.LocalPath, decodeWidth)\n                                : new Bitmap(uri.LocalPath);\n                        }\n\n                        return await LoadImageAsync(uri, decodeWidth, newTokenSource.Token);\n                    }\n\n                    if (uri.Scheme == \"avares\")\n                    {\n                        return new Bitmap(AssetLoader.Open(uri));\n                    }\n\n                    throw new UriFormatException($\"Uri has unsupported scheme. Uri:{source}\");\n                },\n                CancellationToken.None\n            );\n\n            newTokenSource.Token.ThrowIfCancellationRequested();\n\n            AttachSource(bitmap, newTokenSource.Token);\n        }\n        catch (OperationCanceledException ex)\n        {\n            State = AsyncImageState.Unloaded;\n\n            // Logger.Info(ex, \"Canceled loading image from {Uri}\", uri);\n        }\n        catch (Exception ex)\n        {\n            State = AsyncImageState.Failed;\n","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Avalonia/Controls/VendorLabs/AsyncImage/BetterAsyncImage.cs#L154-L190","documentation":"BetterAsyncImage.SetSource loads the image by inspecting the URI scheme: 'avares' is loaded via AssetLoader, and any other scheme (http, https, file, data) reaches an explicit UriFormatException('Uri has unsupported scheme'). This vendored async image control only supports Avalonia resource URIs in this code path.","triggerScenarios":"Binding Source to an http://, https://, file:// or data: URI, or passing a malformed/empty URI whose scheme is neither 'avares' nor handled by earlier branches.","commonSituations":"Migrating from a normal Image/AsyncImage that accepted web URLs to BetterAsyncImage without converting assets to avares:// resources; a null/empty Source producing a default URI with no recognized scheme.","solutions":["Convert the image into an Avalonia resource and reference it as avares://<Assembly>/Assets/...","Use a different control (e.g. the async image variant that supports http) for remote URLs","Pre-download the image and embed it as a resource","Validate the URI scheme before assigning Source"],"exampleFix":"// before\nimage.Source = new Uri(\"https://example.com/pic.png\");\n// after\nimage.Source = new Uri(\"avares://StabilityMatrix.Avalonia/Assets/pic.png\");","handlingStrategy":"validation","validationCode":"if (source is { } u && u.Scheme != \"avares\")\n    throw new NotSupportedException($\"BetterAsyncImage supports only avares URIs, got {u.Scheme}\");","typeGuard":"bool IsResourceUri(Uri? u) => u?.Scheme == \"avares\";","tryCatchPattern":"try { image.Source = uri; }\ncatch (UriFormatException ex) { Log.Error(ex, \"Unsupported URI scheme: {Uri}\", uri); image.Source = fallbackBitmap; }","preventionTips":["Embed remote images as Avalonia resources when using this control","Validate Source URIs at view-model level before binding","Pick a web-capable image control for http(s) sources"],"tags":["avalonia","image","uri","unsupported-scheme"],"backgroundTag":"unsupported-operation","analyzedSha":"af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002","analyzedAt":"2026-09-12T19:02:43.389Z","contentChangedAt":"2026-09-12T19:02:43.389Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}