beemdevelopment/Aegis · error · IOException

Cannot load SVG from stream

Error message

Cannot load SVG from stream

What it means

Wraps any exception from SVG.getFromInputStream (an IOException) while decoding an entry icon, signaling the stream does not contain a valid, parseable SVG document. It fires on corrupt, truncated, or mislabeled SVG icon data; callers propagate it as an IOException to Glide's decoding pipeline.

Solutions

  1. Wrap SVG.getFromInputStream in try-catch and propagate the IOException so Glide's decode pipeline reports the failure
  2. Verify the stream is non-null and contains SVG markup (startsWith "<svg" or "<?xml") before calling SVG.getFromInputStream
  3. Catch SVGParseException specifically and rethrow as IOException with context about the malformed resource
  4. Log the raw bytes length read from the stream to confirm the icon data is not empty or truncated
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at app/src/main/java/com/beemdevelopment/aegis/ui/glide/SvgDecoder.java:41 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of beemdevelopment/Aegis@d6f4e5925a (2026-09-08). Data as JSON: /api/errors/c610cc7efa168d89. Report an issue: GitHub.

Appendix: source

Thrown at app/src/main/java/com/beemdevelopment/aegis/ui/glide/SvgDecoder.java:41

    @Override
    public boolean handles(@NonNull InputStream source, @NonNull Options options) {
        return options.get(VaultEntryIconLoader.ICON_TYPE) == IconType.SVG;
    }

    public Resource<SVG> decode(
            @NonNull InputStream source, int width, int height, @NonNull Options options)
            throws IOException {
        try {
            SVG svg = SVG.getFromInputStream(source);
            if (width != SIZE_ORIGINAL) {
                svg.setDocumentWidth(width);
            }
            if (height != SIZE_ORIGINAL) {
                svg.setDocumentHeight(height);
            }
            return new SimpleResource<>(svg);
        } catch (SVGParseException ex) {
            throw new IOException("Cannot load SVG from stream", ex);
        }
    }
}

View on GitHub (pinned to d6f4e5925a)