Tencent/matrix · error · IllegalStateException

bad extra info line

Error message

bad extra info line: <line>

What it means

While parsing the extra-info section of result.info, every non-comment line must contain a key=value pair (split on optional whitespace around '='). Lines with no '=' separator cannot be parsed and abort analysis with IllegalStateException, including the offending line in the message.

Solutions

  1. Open result.info and fix/remove the offending line so it is either a '#' comment or key=value
  2. Ensure each key has a value: 'key=value' with '=' separator
  3. Rewrite result.info with proper line endings so lines are not merged

Example fix

// before (result.info extra section)
leakCount
key=value
// after
leakCount=2
key=value
Defensive patterns

Strategy: validation

Validate before calling

for (String line : extraLines) {
  if (line.startsWith("#") || line.trim().isEmpty()) continue;
  if (!line.contains("=")) throw new IllegalArgumentException("bad extra info line: " + line);
}

Type guard

null

Try / catch

try { doAnalyze(args); } catch (IllegalStateException e) { if (e.getMessage().startsWith("bad extra info line")) { /* fix result.info and retry */ } }

Prevention

When it happens

Trigger: result.info extra-info contains a bare line without '=' (e.g. just a key, a stray token, or a corrupted/partial line).

Common situations: Manual editing of result.info leaving orphan lines; text editors stripping the '=value' part; concatenation of files without a trailing newline merging two lines.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08). Data as JSON: /api/errors/8e403ba482302647. 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:263

            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;
                        }
                        final String[] pair = line.split("\\s*=\\s*");
                        if (pair.length < 2) {
                            throw new IllegalStateException("bad extra info line: " + line);
                        }
                        final String key = pair[0].trim();
                        final String value = pair[1].trim();
                        extraInfo.put(key, value);
                    }
                } finally {
                    StreamUtil.closeQuietly(br2);
                }
            }

            // Then do analyzing works and output into directory or zip according to the option. Besides,
            // store extra info into the result json by the way.
            analyzeAndStoreResult(tempHprofFile, sdkVersion, manufacturer, leakedActivityKey, extraInfo);
        } finally {
            if (tempHprofFile != null) {
                tempHprofFile.delete();
            }
            StreamUtil.closeQuietly(br);

View on GitHub (pinned to 3b8293bd65)