{"record":{"id":"8a07a2164b335225","repo":"microsoft/typescript-go","slug":"failed-to-marshal-type-d-w","errorCode":null,"errorMessage":"failed to marshal type %d: %w","messagePattern":"failed to marshal type (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tracing/tracing.go","lineNumber":520,"sourceCode":"\tt.mu.Lock()\n\ttypes := slices.Clone(t.types)\n\tt.mu.Unlock()\n\n\tif len(types) == 0 {\n\t\treturn nil\n\t}\n\n\tvar sb strings.Builder\n\t// Write opening bracket (no newline so type ID matches line number)\n\tsb.WriteString(\"[\")\n\n\trecursionIdentityMap := make(map[any]int)\n\n\tfor i, typ := range types {\n\t\tdescriptor := t.buildTypeDescriptor(typ, recursionIdentityMap)\n\n\t\tif err := json.MarshalWrite(&sb, descriptor); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to marshal type %d: %w\", typ.Id(), err)\n\t\t}\n\n\t\tif i < len(types)-1 {\n\t\t\tsb.WriteString(\",\\n\")\n\t\t}\n\t}\n\n\tsb.WriteString(\"]\\n\")\n\n\treturn t.fs.WriteFile(t.typesPath, sb.String())\n}\n\n// TypeDescriptor represents a type in the output JSON\ntype TypeDescriptor struct {\n\tID                      uint32   `json:\"id\"`\n\tIntrinsicName           string   `json:\"intrinsicName,omitzero\"`\n\tSymbolName              string   `json:\"symbolName,omitzero\"`\n\tRecursionID             *int     `json:\"recursionId,omitzero\"`","sourceCodeStart":502,"sourceCodeEnd":538,"githubUrl":"https://github.com/microsoft/typescript-go/blob/1bcfa18d79a3be41772223d5c05dfe4480e614ff/internal/tracing/tracing.go#L502-L538","documentation":"Error \"failed to marshal type %d: %w\" thrown in microsoft/typescript-go.","triggerScenarios":"Thrown at internal/tracing/tracing.go:520 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"}