microsoft/typescript-go · error
failed to marshal legend file: %w
Error message
failed to marshal legend file: %w
What it means
Error "failed to marshal legend file: %w" thrown in microsoft/typescript-go.
Source
Thrown at internal/tracing/tracing.go:475
}
// 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)
}
return nil
}
// typeTracer is the per-checker tracer implementation
type typeTracer struct {
fs vfs.FS
checkerIndex int
typesPath string
types []TracedType
mu sync.Mutex
}
func (t *typeTracer) RecordType(typ TracedType) {View on GitHub (pinned to 1bcfa18d79)
When it happens
Trigger: Thrown at internal/tracing/tracing.go:475 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/3a3c5a9de8297003.
Report an issue: GitHub.