{"record":{"id":"8daa77480d80671b","repo":"microsoft/typescript-go","slug":"submodules-typescript-does-not-exist-try-running","errorCode":null,"errorMessage":"_submodules/TypeScript does not exist; try running `git submodule update --init --recursive`","messagePattern":"_submodules/TypeScript does not exist; try running `git submodule update --init --recursive`","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"Herebyfile.mjs","lineNumber":167,"sourceCode":"        const stat = fs.statSync(path.join(typeScriptSubmodulePath, \"package.json\"));\r\n        if (stat.isFile()) {\r\n            return true;\r\n        }\r\n    }\r\n    catch {}\r\n\r\n    return false;\r\n});\r\n\r\nconst warnIfTypeScriptSubmoduleNotCloned = memoize(() => {\r\n    if (!isTypeScriptSubmoduleCloned()) {\r\n        console.warn(pc.yellow(\"Warning: TypeScript submodule is not cloned; some tests may be skipped.\"));\r\n    }\r\n});\r\n\r\nfunction assertTypeScriptCloned() {\r\n    if (!isTypeScriptSubmoduleCloned()) {\r\n        throw new Error(\"_submodules/TypeScript does not exist; try running `git submodule update --init --recursive`\");\r\n    }\r\n}\r\n\r\nconst tools = new Map([\r\n    [\"gotest.tools/gotestsum\", \"latest\"],\r\n]);\r\n\r\n/**\r\n * @param {string} tool\r\n */\r\nfunction isInstalled(tool) {\r\n    return !!which.sync(tool, { nothrow: true });\r\n}\r\n\r\nconst builtLocal = \"./built/local\";\r\n\r\nconst libsDir = \"./internal/bundled/libs\";\r\nconst libsRegexp = /(?:^|[\\\\/])internal[\\\\/]bundled[\\\\/]libs[\\\\/]/;\r","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/microsoft/typescript-go/blob/1bcfa18d79a3be41772223d5c05dfe4480e614ff/Herebyfile.mjs#L149-L185","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":"// before\ntr, err := tracing.StartTracing(fs, traceDir, cfg, false)\n// -> \"failed to write trace file header: ...\" when traceDir is missing\n\n// after\nif err := os.MkdirAll(traceDir, 0o755); err != nil {\n\treturn fmt.Errorf(\"create trace dir: %w\", err)\n}\ntr, err := tracing.StartTracing(fs, traceDir, cfg, false)","handlingStrategy":"validation","validationCode":"// ensure the target directory exists and is writable before starting\nif err := os.MkdirAll(traceDir, 0o755); err != nil {\n\treturn fmt.Errorf(\"prepare trace dir: %w\", err)\n}\nif f, err := os.Create(filepath.Join(traceDir, \".probe\")); err != nil {\n\treturn fmt.Errorf(\"trace dir not writable: %w\", err)\n} else { f.Close(); os.Remove(filepath.Join(traceDir, \".probe\")) }","typeGuard":null,"tryCatchPattern":"tr, err := tracing.StartTracing(fs, traceDir, cfg, deterministic)\nif err != nil {\n\t// tracing is optional diagnostics: log and continue untraced rather than failing the build\n\tlog.Printf(\"tracing disabled: %v\", err)\n\ttr = nil // Tracing methods are nil-safe\n}","preventionTips":["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."],"tags":["tracing","filesystem","initialization","io"],"backgroundTag":null,"analyzedSha":"1bcfa18d79a3be41772223d5c05dfe4480e614ff","analyzedAt":"2026-08-16T02:12:00.115Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}