oxc-project/oxc · error
File path must be present for rule diagnostics
Error message
File path must be present for rule diagnostics
What it means
Runtime guard in tsgolint.rs when decoding a rule diagnostic payload whose file path field is missing. The diagnostic cannot be attributed to a source file without it, so the conversion fails; it signals malformed or version-mismatched JSON from the tsgolint process.
Source
Thrown at crates/oxc_linter/src/tsgolint.rs:1291
DiagnosticKind::Rule => TsGoLintDiagnostic::Rule(TsGoLintRuleDiagnostic {
rule: diagnostic_payload
.rule
.expect("Rule name must be present for rule diagnostics"),
span: diagnostic_payload.range.map_or_else(
|| {
debug_assert!(false, "Range must be present for rule diagnostics");
Span::default()
},
|range| Span::new(range.pos, range.end),
),
message: diagnostic_payload.message,
fixes: diagnostic_payload.fixes,
suggestions: diagnostic_payload.suggestions,
labeled_ranges: diagnostic_payload.labeled_ranges,
file_path: PathBuf::from(
diagnostic_payload
.file_path
.expect("File path must be present for rule diagnostics"),
),
}),
DiagnosticKind::Internal => {
TsGoLintDiagnostic::Internal(TsGoLintInternalDiagnostic {
message: diagnostic_payload.message,
span: diagnostic_payload.range.map(|range| Span::new(range.pos, range.end)),
file_path: diagnostic_payload.file_path.map(PathBuf::from),
})
}
}))
}
MessageType::Timing => {
let timing_payload = serde_json::from_str::<TsGoLintTimingPayload>(&payload_str)
.map_err(TsGoLintMessageParseError::InvalidTimingPayload)?;
Ok(TsGoLintMessage::Timing(timing_payload))
}
}View on GitHub (pinned to a3d33dda7c)
Solutions
- Ensure tsgolint includes the file path in every diagnostic message
- Verify the tsgolint binary version matches the protocol expected by this oxc version
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at crates/oxc_linter/src/tsgolint.rs:1291 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of oxc-project/oxc@a3d33dda7c (2026-08-20).
Data as JSON: /api/errors/23d3b5f134e7d4f1.
Report an issue: GitHub.