midudev/autoskills · warning

⚠️ No se pudo revertir el commit de release automáticamente

Error message

⚠️  No se pudo revertir el commit de release automáticamente

What it means

In rollbackRelease(), after failing to delete the tag, the script attempts `git reset --hard <releaseStartHead>` to undo the release commit. If that git reset fails, it logs this warning and falls through to restoring the touched files (package.json, CHANGELOG.md) directly from their saved original contents. It signals the commit could not be reverted automatically.

Solutions

  1. Manually revert: `git reset --hard <releaseStartHead>` (find the SHA in the script output or reflog via `git reflog`).
  2. If the script fell through, confirm package.json and CHANGELOG.md were restored to their original content (`git diff`).
  3. Clean the working tree (`git stash` or commit unrelated work) and re-run rollback so the hard reset can succeed.

Example fix

// before
# stuck with a bad release commit
git log -1  # release commit still in history
// after
git reset --hard HEAD~1  # or the releaseStartHead SHA logged by the script
Defensive patterns

Strategy: try-catch

Validate before calling

test -z "$(git status --porcelain)" && echo "clean tree: hard reset safe" || echo "stash/commit changes first"

Try / catch

try {
  run(`git reset --hard ${releaseStartHead}`, { cwd: REPO_ROOT });
} catch (err) {
  console.warn(`⚠️  Reset falló (${err.message}); ejecuta manualmente: git reset --hard ${releaseStartHead}`);
}

Prevention

When it happens

Trigger: rollbackRelease() runs `git reset --hard ${releaseStartHead}` and the command exits non-zero — e.g. uncommitted changes blocking a hard reset, the commit ref no longer exists, or git errors — while commitCreated is true.

Common situations: A release failed after the release commit was made; the developer made new changes on top so the reset is risky/blocked; git hooks or a dirty index cause the reset to fail in CI.

Understand the failure class

Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.

Related errors


AI-assisted analysis of midudev/autoskills@0ec725320d (2026-09-15). Data as JSON: /api/errors/82f2c3646c6d0a22. Report an issue: GitHub.

Appendix: source

Thrown at packages/autoskills/scripts/release.mjs:270

function rollbackRelease() {
  console.log("\n↩️  Revirtiendo cambios locales de la release fallida...");

  if (tagCreated) {
    try {
      run(`git tag -d v${newVersion}`, { cwd: REPO_ROOT });
      console.log(`✅ Tag v${newVersion} eliminado`);
    } catch {
      console.warn(`⚠️  No se pudo eliminar el tag v${newVersion}`);
    }
  }

  if (commitCreated) {
    try {
      run(`git reset --hard ${releaseStartHead}`, { cwd: REPO_ROOT });
      console.log("✅ Commit de release revertido");
      return;
    } catch {
      console.warn("⚠️  No se pudo revertir el commit de release automáticamente");
    }
  }

  // If no release commit was created, restore touched files directly.
  try {
    writeFileSync(PKG_PATH, originalPkgContent);

    if (originalChangelogContent === null) {
      if (existsSync(CHANGELOG_PATH)) {
        rmSync(CHANGELOG_PATH);
      }
    } else {
      writeFileSync(CHANGELOG_PATH, originalChangelogContent);
    }

    run("git restore --staged package.json CHANGELOG.md", { cwd: ROOT });
    console.log("✅ package.json y CHANGELOG.md restaurados");
  } catch {

View on GitHub (pinned to 0ec725320d)