{"record":{"id":"53b180f9275677c2","repo":"theonedev/onedev","slug":"error-parsing-mypy-output-no-message-found","errorCode":null,"errorMessage":"Error parsing mypy output: no message found","messagePattern":"Error parsing mypy output: no message found","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-plugin/server-plugin-report-mypy/src/main/java/io/onedev/server/plugin/report/mypy/MypyReportParser.java","lineNumber":68,"sourceCode":"\t\t\t\t\tparsedLine.toColumn = -1;\n\t\t\t\t} else {\n\t\t\t\t\tparsedLine.fromRow = locations.get(0);\n\t\t\t\t\tparsedLine.fromColumn = 1;\n\t\t\t\t\tparsedLine.toRow = parsedLine.fromRow;\n\t\t\t\t\tparsedLine.toColumn = -1;\n\t\t\t\t}\n\t\t\t\tparsedLine.error = field.trim().equals(\"error\");\n\t\t\t\tvar message = Joiner.on(':').join(fields.subList(i+1, fields.size()));\n\t\t\t\tif (message.startsWith(\"  \")) {\n\t\t\t\t\tparsedLine.complementary = true;\n\t\t\t\t\tparsedLine.message = message.substring(2);\n\t\t\t\t} else {\n\t\t\t\t\tparsedLine.message = message.substring(1);\n\t\t\t\t}\n\t\t\t\treturn parsedLine;\n\t\t\t}\n\t\t}\n\t\tthrow new ExplicitException(\"Error parsing mypy output: no message found\");\n\t}\n\t\n\tprivate static void populateCodeProblems(List<CodeProblem> problems, Build build, Map<String, Optional<String>> blobPaths, \n\t\t\t\t\t\t\t\t\t   ParsedLine parsedLine, TaskLogger logger) {\n\t\tvar blobPath = blobPaths.get(parsedLine.filePath);\n\t\tif (blobPath == null) {\n\t\t\tblobPath = Optional.ofNullable(build.getBlobPath(parsedLine.filePath));\n\t\t\tif (blobPath.isEmpty())\n\t\t\t\tlogger.warning(\"Unable to find blob path for file: \" + parsedLine.filePath);\n\t\t\tblobPaths.put(parsedLine.filePath, blobPath);\n\t\t}\n\t\tif (blobPath.isPresent()) {\n\t\t\tvar location = new PlanarRange(parsedLine.fromRow-1, parsedLine.fromColumn-1, parsedLine.toRow-1, parsedLine.toColumn, 1);\n\t\t\tvar severity = parsedLine.error?MEDIUM:LOW;\n\t\t\tproblems.add(new CodeProblem(severity, new BlobTarget(blobPath.get(), location), escapeHtml5(parsedLine.message)));\n\t\t}\n\t}\n\t","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-plugin/server-plugin-report-mypy/src/main/java/io/onedev/server/plugin/report/mypy/MypyReportParser.java#L50-L86","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure the report step receives only mypy diagnostic output (myproject file) without success/summary lines.","Run mypy with plain output format: avoid --pretty/--verbose, or add --no-pretty.","Capture only mypy's stdout to the output file, not the full console log.","Upgrade/align the mypy report plugin with your mypy version if the line format changed.","Filter out non-diagnostic lines (warnings, pip output) from the report file."],"exampleFix":"// before\nmypy . > mypy-output.txt   # captures 'Success: no issues found' too\n\n// after\nmypy --no-pretty . || true # and let the report step consume only diagnostic lines\n# or filter: grep -E '^[^:]+:[0-9]+(:[0-9]+)?:' mypy-output.txt","handlingStrategy":"validation","validationCode":"# only hand mypy diagnostic lines to the report step\nmypy --no-pretty . | grep -E '^[^:]+:[0-9]+(:[0-9]+)?:' > myproject || true","typeGuard":null,"tryCatchPattern":"try {\n  publishMypyReport(mypyOutput);\n} catch (e) {\n  if (/Error parsing mypy output/.test(e.message)) {\n    console.error('mypy output file contains non-diagnostic lines; regenerate with plain format');\n  } else {\n    throw e;\n  }\n}","preventionTips":["Feed only mypy's stdout (diagnostics) into the report step.","Avoid --pretty/--verbose and daemon modes for published reports.","Pin/align mypy and the report plugin versions.","Filter success/summary lines out of the output file."],"tags":["parser","mypy","ci-report"],"backgroundTag":"unexpected-response-shape","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}