{"record":{"id":"35518caa07b178c1","repo":"microsoft/typescript-go","slug":"no-members-found-for-enum-def-name-in-def-gof","errorCode":null,"errorMessage":"No members found for enum ${def.name} in ${def.goFile}","messagePattern":"No members found for enum (.+?) in (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"Herebyfile.mjs","lineNumber":455,"sourceCode":"        result += JSON.parse(`\"${stringMatch[1]}\"`);\r\n    }\r\n    return JSON.stringify(result);\r\n}\r\n\r\n/**\r\n * @param {EnumDef} def\r\n * @returns {{ name: string, value: string }[]}\r\n */\r\nfunction parseGoEnum(def) {\r\n    const source = fs.readFileSync(def.goFile, \"utf-8\");\r\n    const constBlockRegex = /const\\s*\\(([\\s\\S]*?)\\n\\)/g;\r\n\r\n    for (const match of source.matchAll(constBlockRegex)) {\r\n        const members = parseGoConstBlock(match[1], def).filter(member => !def.excludeMembers?.includes(member.name));\r\n        if (members.length > 0) return topoSortMembers(members);\r\n    }\r\n\r\n    throw new Error(`No members found for enum ${def.name} in ${def.goFile}`);\r\n}\r\n\r\n/**\r\n * Topologically sort enum members so composite members appear after\r\n * all members they reference (Go allows forward references, TS does not).\r\n * @param {{ name: string, value: string }[]} members\r\n * @returns {{ name: string, value: string }[]}\r\n */\r\nfunction topoSortMembers(members) {\r\n    const nameSet = new Set(members.map(m => m.name));\r\n    /** @type {Map<string, Set<string>>} */\r\n    const deps = new Map();\r\n    for (const m of members) {\r\n        /** @type {Set<string>} */\r\n        const refs = new Set();\r\n        // Find all identifier references in the value that are other member names\r\n        for (const [ref] of m.value.matchAll(/\\b([A-Za-z_]\\w*)\\b/g)) {\r\n            if (ref !== m.name && nameSet.has(ref)) refs.add(ref);\r","sourceCodeStart":437,"sourceCodeEnd":473,"githubUrl":"https://github.com/microsoft/typescript-go/blob/1bcfa18d79a3be41772223d5c05dfe4480e614ff/Herebyfile.mjs#L437-L473","documentation":"StopTracing first finalizes every per-checker type tracer by calling tracer.DumpTypes() (done before taking tr.mu because type display can re-enter the checker via Push/Pop). If any checker's dump fails, StopTracing aborts immediately with this wrap, including the failing checkerIndex — meaning the trace file close, legend sort, and legend write in the remainder of StopTracing never run. The underlying failure is usually the type-file write or a per-type marshal failure inside DumpTypes (surfaces as 'failed to marshal type %d' one level down).","triggerScenarios":"StopTracing on a session where a typeTracer cannot serialize/write its types_<n>.json in traceDir: traceDir or the types file unwritable/deleted at teardown, disk full, or a type descriptor containing a value the JSON encoder rejects (NaN/Inf float, unsupported value type). Any single checker failing aborts the whole stop sequence.","commonSituations":"Trace directory cleaned up by an external job before the process exits; disk quota exhausted exactly at teardown; exotic checked types (NaN-producing displays) recorded during the run; multi-checker (project + library) sessions where only one checker's dump hits the bad file.","solutions":["Use the checker index in the message to identify which types_<n>.json failed, then check writability/existence of that path in traceDir.","Verify disk space and directory permissions; keep traceDir untouched for the whole process lifetime.","If the root cause is 'failed to marshal type %d', follow that error's guidance (unencodable descriptor value) instead of chasing I/O.","Re-run tracing after fixing the I/O or value issue — aborted StopTracing leaves trace.json unclosed and legend.json missing."],"exampleFix":"// before: error dropped, all outputs half-written\n_ = tr.StopTracing()\n\n// after: capture and act on the failing checker\nif err := tr.StopTracing(); err != nil {\n\tlog.Printf(\"trace teardown failed: %v\", err) // check types_%d.json path/disk\n\treturn err\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := tr.StopTracing(); err != nil {\n\tif strings.Contains(err.Error(), \"failed to dump types for checker\") {\n\t\t// parse the checker index from the message; check types_%d.json path/disk;\n\t\t// trace.json is left unclosed and legend.json missing — re-run after fixing\n\t\tlog.Printf(\"type dump failed: %v\", err)\n\t}\n\treturn err\n}","preventionTips":["Keep traceDir writable for the entire process lifetime, including teardown.","Free disk headroom before traced runs — DumpTypes writes happen at StopTracing.","Watch for chained errors: 'failed to dump types for checker' usually wraps 'failed to marshal type %d' or a raw write error; read the full chain."],"tags":["tracing","type-checker","teardown","io"],"backgroundTag":null,"analyzedSha":"1bcfa18d79a3be41772223d5c05dfe4480e614ff","analyzedAt":"2026-08-16T02:12:00.115Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}