microsoft/typescript-go · error

Source file does not exist: ${src}

Error message

Source file does not exist: ${src}

What it means

In fake-signing mode (MBSIGN_APPFOLDER unset), every SignFileList entry's SrcPath is checked with fs.existsSync before a stand-in signature is written. A missing source file aborts the fake-sign run instead of producing bogus output.

Source

Thrown at Herebyfile.mjs:1299

 *
 * @param {DDSignFileList} filelist
 */
async function sign(filelist, unchangedOutputOkay = false) {
    let data = JSON.stringify(filelist, undefined, 4);
    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}`);

View on GitHub (pinned to 1bcfa18d79)

Solutions

  1. Run the build/packaging tasks that produce the listed artifacts before the signing task
  2. Regenerate the signing filelist so SrcPath matches current artifact paths
  3. Remove entries from the filelist for artifacts that no longer exist
Defensive patterns

Strategy: validation

Validate before calling

import fs from "node:fs";
for (const record of filelist.SignFileRecordList) {
  for (const f of record.SignFileList) {
    if (!fs.existsSync(f.SrcPath)) throw new Error(`Build artifact missing before signing: ${f.SrcPath}`);
  }
}

Prevention

When it happens

Trigger: Running the sign task before the artifacts listed in the signing filelist were built, after built/ outputs were cleaned, or with a filelist containing stale/wrong SrcPath values.

Common situations: Testing the signing flow locally without a full build; regenerating filelists that reference renamed or removed outputs.

Related errors


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