{"record":{"id":"a0e7bdc3ffc17f60","repo":"oxc-project/oxc","slug":"rule-name-must-be-present-for-rule-diagnostics","errorCode":null,"errorMessage":"Rule name must be present for rule diagnostics","messagePattern":"Rule name must be present for rule diagnostics","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/tsgolint.rs","lineNumber":1276,"sourceCode":"    let payload_str = String::from_utf8_lossy(&payload_bytes);\n\n    match message_type {\n        MessageType::Error => {\n            let error_payload = serde_json::from_str::<TsGoLintErrorPayload>(&payload_str)\n                .map_err(TsGoLintMessageParseError::InvalidErrorPayload)?;\n\n            Ok(TsGoLintMessage::Error(TsGoLintError { error: error_payload.error }))\n        }\n        MessageType::Diagnostic => {\n            let diagnostic_payload =\n                serde_json::from_str::<TsGoLintDiagnosticPayload>(&payload_str)\n                    .map_err(TsGoLintMessageParseError::InvalidDiagnosticPayload)?;\n\n            Ok(TsGoLintMessage::Diagnostic(match diagnostic_payload.kind {\n                DiagnosticKind::Rule => TsGoLintDiagnostic::Rule(TsGoLintRuleDiagnostic {\n                    rule: diagnostic_payload\n                        .rule\n                        .expect(\"Rule name must be present for rule diagnostics\"),\n                    span: diagnostic_payload.range.map_or_else(\n                        || {\n                            debug_assert!(false, \"Range must be present for rule diagnostics\");\n                            Span::default()\n                        },\n                        |range| Span::new(range.pos, range.end),\n                    ),\n                    message: diagnostic_payload.message,\n                    fixes: diagnostic_payload.fixes,\n                    suggestions: diagnostic_payload.suggestions,\n                    labeled_ranges: diagnostic_payload.labeled_ranges,\n                    file_path: PathBuf::from(\n                        diagnostic_payload\n                            .file_path\n                            .expect(\"File path must be present for rule diagnostics\"),\n                    ),\n                }),\n                DiagnosticKind::Internal => {","sourceCodeStart":1258,"sourceCodeEnd":1294,"githubUrl":"https://github.com/oxc-project/oxc/blob/a3d33dda7cb69da23db4fcaa2c0c05de61e760a1/crates/oxc_linter/src/tsgolint.rs#L1258-L1294","documentation":"Runtime panic path in tsgolint.rs while converting a tsgolint diagnostic message: the payload was typed as a Rule diagnostic but its rule field was absent, so the .expect() guard aborts. It indicates the tsgolint binary sent malformed diagnostic JSON missing the rule name.","triggerScenarios":"Thrown at crates/oxc_linter/src/tsgolint.rs:1276 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure tsgolint always includes a rule name in rule diagnostic payloads","Update the pinned tsgolint version if a newer one fixes the payload format","Check the protocol handshake so non-rule diagnostics are not decoded as Rule kind"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a3d33dda7cb69da23db4fcaa2c0c05de61e760a1","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}