{"record":{"id":"5ddcb6f42ed15686","repo":"microsoft/typescript-go","slug":"32603","errorCode":"-32603","errorMessage":"panic: %v\n%s","messagePattern":"panic: (.+?)\n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/api/conn_async.go","lineNumber":142,"sourceCode":"\t\tif writeErr != nil {\n\t\t\tpanic(fmt.Sprintf(\"api: failed to write reset server timing response: %v\", writeErr))\n\t\t}\n\t\treturn\n\t}\n\n\tvar result any\n\tvar err error\n\n\tstart := time.Time{}\n\tif c.timing != nil {\n\t\tstart = time.Now()\n\t}\n\n\t// Recover from panics and convert to error response with stack trace\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tstack := string(debug.Stack())\n\t\t\terr = fmt.Errorf(\"panic: %v\\n%s\", r, stack)\n\n\t\t\tc.writeMu.Lock()\n\t\t\twriteErr := c.protocol.WriteError(msg.ID, &jsonrpc.ResponseError{\n\t\t\t\tCode:    jsonrpc.CodeInternalError,\n\t\t\t\tMessage: err.Error(),\n\t\t\t})\n\t\t\tc.writeMu.Unlock()\n\n\t\t\tif writeErr != nil {\n\t\t\t\tpanic(fmt.Sprintf(\"api: failed to write panic error response: %v (original panic: %v)\", writeErr, r))\n\t\t\t}\n\t\t}\n\t}()\n\n\tresult, err = c.handler.HandleRequest(ctx, msg.Method, msg.Params)\n\n\tif c.timing != nil {\n\t\tc.timing.record(msg.Method, time.Since(start))","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/microsoft/typescript-go/blob/1bcfa18d79a3be41772223d5c05dfe4480e614ff/internal/api/conn_async.go#L124-L160","documentation":"The async JSON-RPC connection recovered a panic inside a request handler and converted it to a JSON-RPC error response with code -32603 (internal error), embedding the panic value and full Go stack trace in the message. The client sees a remote internal error; the server keeps running.","triggerScenarios":"Any panic (nil deref, index out of range, failed invariant) in a method dispatched through AsyncConn's handler; bugs in server-side request processing rather than in the transport.","commonSituations":"Server crashes on malformed-but-parsed params, uninitialized optional state (e.g. nil timing/FS), or regressions in a method implementation after an upgrade.","solutions":["Read the embedded stack trace to find the faulting server code path and report/fix it","Update the server binary — many such panics are fixed regressions","Work around by not sending the parameter combination that triggers it","Retry once in case of a transient race, then surface the error"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"result, err := conn.Call(ctx, method, params)\nif err != nil && strings.Contains(err.Error(), \"panic:\") {\n    // server-side panic: extract stack from message, report upstream, optionally retry once\n}","preventionTips":["Log the embedded stack trace verbatim in bug reports","Keep server binaries current","Fuzz unusual params against handlers during development"],"tags":["json-rpc","go","panic","internal-error"],"backgroundTag":null,"analyzedSha":"1bcfa18d79a3be41772223d5c05dfe4480e614ff","analyzedAt":"2026-08-16T02:12:00.115Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}