Tencent/matrix · error · IllegalStateException

leakedActivityKey is absent in result.info.

Error message

leakedActivityKey is absent in result.info.

What it means

CLIMain.doAnalyze reads the 'leakedActivityKey' from result.info, which identifies which Activity instance leaked and is used to match instances in the heap dump. Without it, analysis results cannot be correlated, so it throws IllegalStateException.

Solutions

  1. Regenerate the result bundle with a matching Matrix version so leakedActivityKey is written
  2. Add 'leakedActivityKey=<value>' to result.info inside the zip (value as produced by the on-device reporter)
  3. Verify key spelling and that result.info was fully written into the zip

Example fix

// before (result.info)
hprofEntry=dump.hprof
// after (result.info)
hprofEntry=dump.hprof
leakedActivityKey=android.app.Activity@12345
Defensive patterns

Strategy: validation

Validate before calling

if (!info.containsKey("leakedActivityKey")) throw new IllegalArgumentException("result.info missing leakedActivityKey");

Type guard

null

Try / catch

try { doAnalyze(args); } catch (IllegalStateException e) { System.err.println("Invalid result bundle: " + e.getMessage()); System.exit(1); }

Prevention

When it happens

Trigger: The result zip's result.info is missing the 'leakedActivityKey' entry (missing line, typo, or bundle produced by incompatible tooling).

Common situations: Hand-edited result.info files; bundles from older Matrix versions without this field; partially overwritten zips.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08). Data as JSON: /api/errors/94afaf8392a48d35. Report an issue: GitHub.

Appendix: source

Thrown at matrix/matrix-android/matrix-resource-canary/matrix-resource-canary-analyzer-cli/src/main/java/com/tencent/matrix/resource/analyzer/CLIMain.java:241

            if (sdkVersionStr == null) {
                throw new IllegalStateException("sdkVersion is absent in result.info.");
            }
            final int sdkVersion = Integer.parseInt(sdkVersionStr);

            final String manufacturer = resultInfoMap.get("manufacturer");
            if (manufacturer == null) {
                throw new IllegalStateException("manufacturer is absent in result.info.");
            }

            final String hprofEntryName = resultInfoMap.get("hprofEntry");
            if (hprofEntryName == null) {
                throw new IllegalStateException("hprofEntry is absent in result.info.");
            }
            final ZipEntry hprofEntry = new ZipEntry(hprofEntryName);

            final String leakedActivityKey = resultInfoMap.get("leakedActivityKey");
            if (leakedActivityKey == null) {
                throw new IllegalStateException("leakedActivityKey is absent in result.info.");
            }

            // We would extract hprof entry into a temporary file.
            tempHprofFile = new File(new File("").getAbsoluteFile(), "temp_" + System.currentTimeMillis() + ".hprof");
            StreamUtil.extractZipEntry(zf, hprofEntry, tempHprofFile);

            // Parse extra info if exists.
            final JSONObject extraInfo = new JSONObject();
            final ZipEntry extraInfoEntry = zf.getEntry(EXTRA_INFO_NAME);
            if (extraInfoEntry != null) {
                BufferedReader br2 = null;
                try {
                    br2 = new BufferedReader(new InputStreamReader(zf.getInputStream(extraInfoEntry)));
                    String line = null;
                    while ((line = br2.readLine()) != null) {
                        if (line.startsWith("#")) {
                            // Skip comment.
                            continue;

View on GitHub (pinned to 3b8293bd65)