facebook/docusaurus · error

Error while executing command code=${obfuscateGitPass(cmd)}

Error message

Error while executing command code=${obfuscateGitPass(cmd)}
In CWD code=${process.cwd()}

What it means

Wrapper error from the deploy `exec` helper's catch block: any thrown error (including the failfast error 116, or an execa throw) is re-thrown with a message naming the obfuscated command and cwd, and the original as {cause}. GIT_PASS values are stripped from the message.

Source

Thrown at packages/docusaurus/src/commands/deploy.ts:56

    //  Use async/await everything
    //  Avoid execa.command: the args need to be escaped manually
    const result = execa.commandSync(cmd);
    if (log || debugMode) {
      logger.info`code=${obfuscateGitPass(
        cmd,
      )} subdue=${`code: ${result.exitCode}`}`;
    }
    if (debugMode) {
      console.log(result);
    }
    if (failfast && result.exitCode !== 0) {
      throw new Error(
        `Command returned unexpected exitCode ${result.exitCode}`,
      );
    }
    return result;
  } catch (err) {
    throw new Error(
      logger.interpolate`Error while executing command code=${obfuscateGitPass(
        cmd,
      )}
In CWD code=${process.cwd()}`,
      {cause: err},
    );
  }
}

// Execa escape args and add necessary quotes automatically
// When using Execa.command, the args containing spaces must be escaped manually
function escapeArg(arg: string): string {
  return arg.replaceAll(' ', '\\ ');
}

function hasGit() {
  return exec('git --version').exitCode === 0;
}

View on GitHub (pinned to 3f483e80e3)

Solutions

  1. Inspect error.cause to find the real failure (often error 116 or a spawn ENOENT).
  2. Fix the underlying git state/credentials per that cause.
  3. Re-run with DOCUSAURUS_DEPLOY_DEBUG=1 for full command output.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await deploy(siteDir, cliOptions);
} catch (e) {
  const cause = (e as Error).cause as Error | undefined;
  // dispatch on cause to find the real git error
  reportDeployError(cause ?? e);
}

Prevention

When it happens

Trigger: Any exception inside execa.commandSync during deploy — spawn failure, non-zero exit with failfast, or a JS-level throw.

Common situations: Same triggers as error 116 plus spawn-level failures (git not found mid-deploy, EPERM on the binary), all surfaced through this single wrapper.

Related errors


AI-assisted analysis of facebook/docusaurus@3f483e80e3 (2026-08-12). Data as JSON: /api/errors/be8c709d59f1f588. Report an issue: GitHub.