microsoft/typescript-go · error · Error
No members found for enum ${def.name} in ${def.goFile}
Error message
No members found for enum ${def.name} in ${def.goFile} What it means
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).
Source
Thrown at Herebyfile.mjs:455
result += JSON.parse(`"${stringMatch[1]}"`);
}
return JSON.stringify(result);
}
/**
* @param {EnumDef} def
* @returns {{ name: string, value: string }[]}
*/
function parseGoEnum(def) {
const source = fs.readFileSync(def.goFile, "utf-8");
const constBlockRegex = /const\s*\(([\s\S]*?)\n\)/g;
for (const match of source.matchAll(constBlockRegex)) {
const members = parseGoConstBlock(match[1], def).filter(member => !def.excludeMembers?.includes(member.name));
if (members.length > 0) return topoSortMembers(members);
}
throw new Error(`No members found for enum ${def.name} in ${def.goFile}`);
}
/**
* Topologically sort enum members so composite members appear after
* all members they reference (Go allows forward references, TS does not).
* @param {{ name: string, value: string }[]} members
* @returns {{ name: string, value: string }[]}
*/
function topoSortMembers(members) {
const nameSet = new Set(members.map(m => m.name));
/** @type {Map<string, Set<string>>} */
const deps = new Map();
for (const m of members) {
/** @type {Set<string>} */
const refs = new Set();
// Find all identifier references in the value that are other member names
for (const [ref] of m.value.matchAll(/\b([A-Za-z_]\w*)\b/g)) {
if (ref !== m.name && nameSet.has(ref)) refs.add(ref);
View on GitHub (pinned to 1bcfa18d79)
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.
Example fix
// before: error dropped, all outputs half-written
_ = tr.StopTracing()
// after: capture and act on the failing checker
if err := tr.StopTracing(); err != nil {
log.Printf("trace teardown failed: %v", err) // check types_%d.json path/disk
return err
} Defensive patterns
Strategy: try-catch
Try / catch
if err := tr.StopTracing(); err != nil {
if strings.Contains(err.Error(), "failed to dump types for checker") {
// parse the checker index from the message; check types_%d.json path/disk;
// trace.json is left unclosed and legend.json missing — re-run after fixing
log.Printf("type dump failed: %v", err)
}
return err
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- ${vendorJsonrpcSrc} is not installed; run `npm ci` first.
- Expected version in .custom-gcl.yml
- _submodules/TypeScript does not exist; try running `git subm
- Cannot parse string enum value: ${goValue}
- Failed to extract version from version.go
AI-assisted analysis of microsoft/typescript-go@1bcfa18d79 (2026-08-16).
Data as JSON: /api/errors/35518caa07b178c1.
Report an issue: GitHub.