theonedev/onedev · error · ExplicitException

Error parsing mypy output: no message found

Error message

Error parsing mypy output: no message found

What it means

The mypy report parser tries a series of regex patterns against each output line to extract file path, line/column, severity, and message; if no pattern matches (i.e. it cannot even find a message), it throws ExplicitException("Error parsing mypy output: no message found"). The parser expects standard mypy diagnostic lines (e.g. file.py:12: error: message [code]); anything else, such as summaries or tool noise, breaks parsing. This guards against silently producing an empty/corrupt report.

Source

Thrown at server-plugin/server-plugin-report-mypy/src/main/java/io/onedev/server/plugin/report/mypy/MypyReportParser.java:68

					parsedLine.toColumn = -1;
				} else {
					parsedLine.fromRow = locations.get(0);
					parsedLine.fromColumn = 1;
					parsedLine.toRow = parsedLine.fromRow;
					parsedLine.toColumn = -1;
				}
				parsedLine.error = field.trim().equals("error");
				var message = Joiner.on(':').join(fields.subList(i+1, fields.size()));
				if (message.startsWith("  ")) {
					parsedLine.complementary = true;
					parsedLine.message = message.substring(2);
				} else {
					parsedLine.message = message.substring(1);
				}
				return parsedLine;
			}
		}
		throw new ExplicitException("Error parsing mypy output: no message found");
	}
	
	private static void populateCodeProblems(List<CodeProblem> problems, Build build, Map<String, Optional<String>> blobPaths, 
									   ParsedLine parsedLine, TaskLogger logger) {
		var blobPath = blobPaths.get(parsedLine.filePath);
		if (blobPath == null) {
			blobPath = Optional.ofNullable(build.getBlobPath(parsedLine.filePath));
			if (blobPath.isEmpty())
				logger.warning("Unable to find blob path for file: " + parsedLine.filePath);
			blobPaths.put(parsedLine.filePath, blobPath);
		}
		if (blobPath.isPresent()) {
			var location = new PlanarRange(parsedLine.fromRow-1, parsedLine.fromColumn-1, parsedLine.toRow-1, parsedLine.toColumn, 1);
			var severity = parsedLine.error?MEDIUM:LOW;
			problems.add(new CodeProblem(severity, new BlobTarget(blobPath.get(), location), escapeHtml5(parsedLine.message)));
		}
	}
	

View on GitHub (pinned to d44925c47c)

Solutions

  1. Ensure the report step receives only mypy diagnostic output (myproject file) without success/summary lines.
  2. Run mypy with plain output format: avoid --pretty/--verbose, or add --no-pretty.
  3. Capture only mypy's stdout to the output file, not the full console log.
  4. Upgrade/align the mypy report plugin with your mypy version if the line format changed.
  5. Filter out non-diagnostic lines (warnings, pip output) from the report file.

Example fix

// before
mypy . > mypy-output.txt   # captures 'Success: no issues found' too

// after
mypy --no-pretty . || true # and let the report step consume only diagnostic lines
# or filter: grep -E '^[^:]+:[0-9]+(:[0-9]+)?:' mypy-output.txt
Defensive patterns

Strategy: validation

Validate before calling

# only hand mypy diagnostic lines to the report step
mypy --no-pretty . | grep -E '^[^:]+:[0-9]+(:[0-9]+)?:' > myproject || true

Try / catch

try {
  publishMypyReport(mypyOutput);
} catch (e) {
  if (/Error parsing mypy output/.test(e.message)) {
    console.error('mypy output file contains non-diagnostic lines; regenerate with plain format');
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: Publishing a mypy report from output that contains non-diagnostic lines, such as 'Success: no issues found', 'Found N errors in M files' summaries, pip install noise, mypy daemon output, or output from an incompatible mypy version/format.

Common situations: Mypy version upgrade changing the line format; running mypy with flags that add extra output (--verbose, --pretty); capturing the whole job log instead of mypy's stdout; plugins emitting custom lines.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/53b180f9275677c2. Report an issue: GitHub.