microsoft/typescript-go · error · Error
_submodules/TypeScript does not exist; try running `git subm
Error message
_submodules/TypeScript does not exist; try running `git submodule update --init --recursive`
What it means
StartTracing writes the Chrome trace-event header (opening '[', process_name/thread_name metadata, TracingStartedInBrowser) to <traceDir>/trace.json via fs.WriteFile, which also truncates any existing trace file so later AppendFile calls extend a clean file. If that initial write fails, tracing cannot start and the constructor returns this wrapped error. The most common cause is that traceDir does not exist or is not writable by the process.
Source
Thrown at Herebyfile.mjs:167
const stat = fs.statSync(path.join(typeScriptSubmodulePath, "package.json"));
if (stat.isFile()) {
return true;
}
}
catch {}
return false;
});
const warnIfTypeScriptSubmoduleNotCloned = memoize(() => {
if (!isTypeScriptSubmoduleCloned()) {
console.warn(pc.yellow("Warning: TypeScript submodule is not cloned; some tests may be skipped."));
}
});
function assertTypeScriptCloned() {
if (!isTypeScriptSubmoduleCloned()) {
throw new Error("_submodules/TypeScript does not exist; try running `git submodule update --init --recursive`");
}
}
const tools = new Map([
["gotest.tools/gotestsum", "latest"],
]);
/**
* @param {string} tool
*/
function isInstalled(tool) {
return !!which.sync(tool, { nothrow: true });
}
const builtLocal = "./built/local";
const libsDir = "./internal/bundled/libs";
const libsRegexp = /(?:^|[\\/])internal[\\/]bundled[\\/]libs[\\/]/;
View on GitHub (pinned to 1bcfa18d79)
Solutions
- Create the trace directory before starting: os.MkdirAll(traceDir, 0o755) (or the vfs.FS equivalent), then call StartTracing.
- Check the directory is writable by the running user and that trace.json is not an existing directory or root-owned file; remove stale files.
- Pass an absolute traceDir so it doesn't depend on the process's working directory.
- If using a custom vfs.FS, verify its WriteFile actually creates files under that path (root prefix/jail configured correctly).
Example fix
// before
tr, err := tracing.StartTracing(fs, traceDir, cfg, false)
// -> "failed to write trace file header: ..." when traceDir is missing
// after
if err := os.MkdirAll(traceDir, 0o755); err != nil {
return fmt.Errorf("create trace dir: %w", err)
}
tr, err := tracing.StartTracing(fs, traceDir, cfg, false) Defensive patterns
Strategy: validation
Validate before calling
// ensure the target directory exists and is writable before starting
if err := os.MkdirAll(traceDir, 0o755); err != nil {
return fmt.Errorf("prepare trace dir: %w", err)
}
if f, err := os.Create(filepath.Join(traceDir, ".probe")); err != nil {
return fmt.Errorf("trace dir not writable: %w", err)
} else { f.Close(); os.Remove(filepath.Join(traceDir, ".probe")) } Try / catch
tr, err := tracing.StartTracing(fs, traceDir, cfg, deterministic)
if err != nil {
// tracing is optional diagnostics: log and continue untraced rather than failing the build
log.Printf("tracing disabled: %v", err)
tr = nil // Tracing methods are nil-safe
} Prevention
- Always MkdirAll the trace directory before StartTracing.
- Use an absolute path on a local, writable volume.
- Run the tracer as the user who owns the output directory.
- Remove stale trace files from previous runs to avoid truncation/permission surprises.
When it happens
Trigger: Calling tracing.StartTracing(fs, traceDir, configFilePath, deterministic) with a traceDir that doesn't exist on the provided vfs.FS, a read-only FS (e.g., an overlay/real FS rooted elsewhere), permission-denied on the directory, a path occupied by a directory at trace.json, or disk-full at header-write time. Also triggered by the --trace CLI path when the trace output location is invalid.
Common situations: Enabling tracing (tsgo --trace or the LSP trace setting) without first creating the output directory; running in a container/CI where the trace dir is read-only or owned by another user; passing a relative traceDir resolved against an unexpected cwd; leftover root-owned trace file from a previous sudo run.
Related errors
- Expected version in .custom-gcl.yml
- Cannot parse string enum value: ${goValue}
- No members found for enum ${def.name} in ${def.goFile}
- ${vendorJsonrpcSrc} is not installed; run `npm ci` first.
- Found ${unusedBaselines.length} unused baseline file(s). Run
AI-assisted analysis of microsoft/typescript-go@1bcfa18d79 (2026-08-16).
Data as JSON: /api/errors/8daa77480d80671b.
Report an issue: GitHub.