microsoft/typescript-go · error

Destination directory does not exist: ${dstDir}

Error message

Destination directory does not exist: ${dstDir}

What it means

Fake-signing mode requires the destination directory (dirname of DstPath, or of SrcPath when DstPath is absent) to already exist before writing .sig or stand-in files. Missing output directories abort the run.

Source

Thrown at Herebyfile.mjs:1304

    console.log("filelist:", data);

    if (!process.env.MBSIGN_APPFOLDER) {
        console.log(pc.yellow("Faking signing because MBSIGN_APPFOLDER is not set."));

        // Fake signing for testing.

        for (const record of filelist.SignFileRecordList) {
            for (const file of record.SignFileList) {
                const src = file.SrcPath;
                const dst = file.DstPath ?? src;

                if (!fs.existsSync(src)) {
                    throw new Error(`Source file does not exist: ${src}`);
                }

                const dstDir = path.dirname(dst);
                if (!fs.existsSync(dstDir)) {
                    throw new Error(`Destination directory does not exist: ${dstDir}`);
                }

                if (dst.endsWith(".sig")) {
                    console.log(`Faking signature for ${src} -> ${dst}`);
                    // No great way to fake a signature.
                    await fs.promises.writeFile(dst, "fake signature");
                }
                else {
                    if (src === dst) {
                        console.log(`Faking signing ${src}`);
                    }
                    else {
                        console.log(`Faking signing ${src} -> ${dst}`);
                    }
                    const contents = await fs.promises.readFile(src);
                    await fs.promises.writeFile(dst, contents);
                }
            }

View on GitHub (pinned to 1bcfa18d79)

Solutions

  1. Ensure an earlier build/packaging task creates the destination directory
  2. Fix DstPath typos so it points at an existing directory
  3. Create the directory where the filelist is generated: fs.mkdirSync(path.dirname(dst), { recursive: true })
Defensive patterns

Strategy: validation

Validate before calling

import fs from "node:fs"; import path from "node:path";
for (const record of filelist.SignFileRecordList) {
  for (const f of record.SignFileList) {
    fs.mkdirSync(path.dirname(f.DstPath ?? f.SrcPath), { recursive: true });
  }
}

Prevention

When it happens

Trigger: DstPath points into a directory that no task created (typo, or the packaging step that creates it has not run), e.g. built/vsix/signatures/ does not exist yet.

Common situations: New signature output locations added to the filelist without a mkdir step; task reordering so signing runs before packaging creates directories.

Related errors


AI-assisted analysis of microsoft/typescript-go@1bcfa18d79 (2026-08-16). Data as JSON: /api/errors/d57c842db5759bbf. Report an issue: GitHub.