{"record":{"id":"51bfcfda7e21bcaa","repo":"microsoft/typescript-go","slug":"compiler-emit-returned-nil-result","errorCode":null,"errorMessage":"compiler emit returned nil result","messagePattern":"compiler emit returned nil result","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/api/session.go","lineNumber":2641,"sourceCode":"\tif value == nil {\n\t\treturn compiler.EmitAll, nil\n\t}\n\tif *value > uint32(compiler.EmitOnlyDts) {\n\t\treturn compiler.EmitAll, fmt.Errorf(\"%w: invalid emitOnly value: %d\", ErrClientError, *value)\n\t}\n\temitOnly := compiler.EmitOnly(*value)\n\treturn emitOnly, nil\n}\n\nfunc emitProgram(ctx context.Context, program *compiler.Program, options compiler.EmitOptions) (*compiler.EmitResult, error) {\n\tresult := program.Emit(ctx, options)\n\tif result != nil {\n\t\treturn result, nil\n\t}\n\tif err := ctx.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn nil, errors.New(\"compiler emit returned nil result\")\n}\n\nfunc nonNilDiagnostics(diags []*ast.Diagnostic) []*DiagnosticResponse {\n\tresult := NewDiagnosticResponses(diags)\n\tif result == nil {\n\t\treturn []*DiagnosticResponse{}\n\t}\n\treturn result\n}\n\n// handleGetIntrinsicType returns an intrinsic type (any, string, number, etc.).\nfunc (s *Session) handleGetIntrinsicType(ctx context.Context, params *GetIntrinsicTypeParams, getter func(*checker.Checker) *checker.Type) (*TypeResponse, error) {\n\tsetup, err := s.setupChecker(ctx, params.Snapshot, params.Project)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer setup.done()\n","sourceCodeStart":2623,"sourceCodeEnd":2659,"githubUrl":"https://github.com/microsoft/typescript-go/blob/1bcfa18d79a3be41772223d5c05dfe4480e614ff/internal/api/session.go#L2623-L2659","documentation":"Error \"compiler emit returned nil result\" thrown in microsoft/typescript-go.","triggerScenarios":"Thrown at internal/api/session.go:2641 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1bcfa18d79a3be41772223d5c05dfe4480e614ff","analyzedAt":"2026-08-16T02:12:00.115Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}