microsoft/typescript-go · error
transpilation produced no output
Error message
transpilation produced no output
What it means
transpileModule / transpileDeclaration returned a nil *transpile.Output while the context was not canceled, so the handler surfaces a bare error with no sentinel. A nil output is an internal bail-out of the transpiler rather than a normal diagnostics-bearing result, so this indicates a compiler bug or an aborted run that failed to report through diagnostics.
Source
Thrown at internal/api/session.go:1262
}
func transpileOutput(ctx context.Context, input string, options TranspileOptions, declaration bool) (*TranspileOutputResponse, error) {
transpileOptions := transpile.Options{
CompilerOptions: options.CompilerOptions,
FileName: options.FileName,
ReportDiagnostics: options.ReportDiagnostics,
}
var output *transpile.Output
if declaration {
output = transpile.TranspileDeclaration(ctx, input, transpileOptions)
} else {
output = transpile.TranspileModule(ctx, input, transpileOptions)
}
if output == nil {
if err := ctx.Err(); err != nil {
return nil, err
}
return nil, errors.New("transpilation produced no output")
}
return &TranspileOutputResponse{
OutputText: output.OutputText,
Diagnostics: NewDiagnosticResponses(output.Diagnostics),
SourceMapText: output.SourceMapText,
}, nil
}
// handleGetSourceFile returns a source file from a project within a snapshot.
func (s *Session) handleGetSourceFile(ctx context.Context, params *GetSourceFileParams) (any, error) {
sd, err := s.getSnapshotData(params.Snapshot)
if err != nil {
return nil, err
}
program, err := sd.getProgram(params.Project)
if err != nil {
return nil, errView on GitHub (pinned to 1bcfa18d79)
Solutions
- Retry once with a fresh, generously-deadlined context
- Reduce the input to the smallest repro and check diagnostics settings (reportDiagnostics: true) to surface real errors
- If it reproduces, report an upstream issue with the input, since nil-output-with-live-context is not an expected result
Example fix
// before
out, err := transpileModule(ctx, hugeInput, opts) // err: transpilation produced no output
return err
// after
out, err := transpileModule(ctx, hugeInput, opts)
if isNoOutputErr(err) {
ctx2, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
out, err = transpileModule(ctx2, hugeInput, opts)
} Defensive patterns
Strategy: retry
Validate before calling
// Nothing to pre-validate reliably (internal nil-output), but bound the context: ctx, cancel := context.WithTimeout(ctx, 30*time.Second) defer cancel()
Type guard
func isNoTranspileOutput(err error) bool {
return err != nil && strings.Contains(err.Error(), "transpilation produced no output")
} Try / catch
out, err := transpileOnce(ctx, input, opts)
if isNoTranspileOutput(err) && ctx.Err() == nil {
ctx2, cancel := context.WithTimeout(context.Background(), 60*time.Second)
defer cancel()
out, err = transpileOnce(ctx2, input, opts) // single retry with fresh context
}
if err != nil { return err } // now a genuine bug: report upstream with the input Prevention
- Set generous deadlines on transpile calls; tight timeouts race the nil-output check
- Enable reportDiagnostics so real errors surface as diagnostics rather than surprises
- Keep the failing input around; nil-output-with-live-context is reportable upstream
When it happens
Trigger: A transpile-internal error path that returns nil instead of an output with diagnostics; a context canceled mid-transpile in a race where ctx.Err() is still nil at the check; pathological input triggering an unhandled case in the transpiler.
Common situations: Aggressive client timeouts around transpile of very large files; nightly typescript-go builds with transpiler regressions; fuzzed or generated inputs exercising unusual syntax.
Related errors
- %w: failed to update snapshot: %w
- failed to encode source file: %w
- Cannot run a temporary file update on an inactive snapshot
- Snapshot is disposed
- Connection not established
AI-assisted analysis of microsoft/typescript-go@1bcfa18d79 (2026-08-16).
Data as JSON: /api/errors/30325f3b0271ba4e.
Report an issue: GitHub.