{"record":{"id":"be8c709d59f1f588","repo":"facebook/docusaurus","slug":"error-while-executing-command-code-obfuscategitp","errorCode":null,"errorMessage":"Error while executing command code=${obfuscateGitPass(cmd)}\nIn CWD code=${process.cwd()}","messagePattern":"Error while executing command code=(.+?)\nIn CWD code=(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/docusaurus/src/commands/deploy.ts","lineNumber":56,"sourceCode":"    //  Use async/await everything\n    //  Avoid execa.command: the args need to be escaped manually\n    const result = execa.commandSync(cmd);\n    if (log || debugMode) {\n      logger.info`code=${obfuscateGitPass(\n        cmd,\n      )} subdue=${`code: ${result.exitCode}`}`;\n    }\n    if (debugMode) {\n      console.log(result);\n    }\n    if (failfast && result.exitCode !== 0) {\n      throw new Error(\n        `Command returned unexpected exitCode ${result.exitCode}`,\n      );\n    }\n    return result;\n  } catch (err) {\n    throw new Error(\n      logger.interpolate`Error while executing command code=${obfuscateGitPass(\n        cmd,\n      )}\nIn CWD code=${process.cwd()}`,\n      {cause: err},\n    );\n  }\n}\n\n// Execa escape args and add necessary quotes automatically\n// When using Execa.command, the args containing spaces must be escaped manually\nfunction escapeArg(arg: string): string {\n  return arg.replaceAll(' ', '\\\\ ');\n}\n\nfunction hasGit() {\n  return exec('git --version').exitCode === 0;\n}","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus/src/commands/deploy.ts#L38-L74","documentation":"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.","triggerScenarios":"Any exception inside execa.commandSync during deploy — spawn failure, non-zero exit with failfast, or a JS-level throw.","commonSituations":"Same triggers as error 116 plus spawn-level failures (git not found mid-deploy, EPERM on the binary), all surfaced through this single wrapper.","solutions":["Inspect error.cause to find the real failure (often error 116 or a spawn ENOENT).","Fix the underlying git state/credentials per that cause.","Re-run with DOCUSAURUS_DEPLOY_DEBUG=1 for full command output."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await deploy(siteDir, cliOptions);\n} catch (e) {\n  const cause = (e as Error).cause as Error | undefined;\n  // dispatch on cause to find the real git error\n  reportDeployError(cause ?? e);\n}","preventionTips":["Always read error.cause to find the real underlying failure.","Run with DOCUSAURUS_DEPLOY_DEBUG=1 to see full command output.","Reproduce the failing git command in isolation before retrying."],"tags":["deploy","git","wrapper","cli"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}