microsoft/typescript-go · error
failed to write trace file: %w
Error message
failed to write trace file: %w
What it means
Error "failed to write trace file: %w" thrown in microsoft/typescript-go.
Source
Thrown at internal/tracing/tracing.go:460
if err := tracer.DumpTypes(); err != nil {
return fmt.Errorf("failed to dump types for checker %d: %w", tracer.checkerIndex, err)
}
}
tr.mu.Lock()
defer tr.mu.Unlock()
// Close the trace file(s)
if tr.traceStarted.Load() {
// Surface any buffered flush failure before attempting the final write.
if tr.flushErr != nil {
tr.traceContent.Reset()
tr.traceStarted.Store(false)
return tr.flushErr
}
// Flush any remaining buffered content and close the JSON array.
if err := tr.fs.AppendFile(tr.tracePath, tr.traceContent.String()+"\n]\n"); err != nil {
return fmt.Errorf("failed to write trace file: %w", err)
}
tr.traceContent.Reset()
tr.traceStarted.Store(false)
}
// Sort legend entries by typesPath for deterministic output
slices.SortFunc(tr.legend, func(a, b TraceRecord) int {
return strings.Compare(a.TypesPath, b.TypesPath)
})
// Write the legend file
legendPath := tspath.CombinePaths(tr.traceDir, "legend.json")
legendData, err := json.MarshalIndent(tr.legend, "", " ")
if err != nil {
return fmt.Errorf("failed to marshal legend file: %w", err)
}
if err := tr.fs.WriteFile(legendPath, string(legendData)); err != nil {
return fmt.Errorf("failed to write legend file: %w", err)View on GitHub (pinned to 1bcfa18d79)
When it happens
Trigger: Thrown at internal/tracing/tracing.go:460 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of microsoft/typescript-go@1bcfa18d79 (2026-08-16).
Data as JSON: /api/errors/118f7285ded27a03.
Report an issue: GitHub.