nodejs/node · error · Exception

%s is not a clean git repo (run git status)

Error message

%s is not a clean git repo (run git status)

What it means

tools/inspector_protocol/roll.py refuses to roll the inspector_protocol project into a node tree unless the *upstream* ip_src checkout has no uncommitted changes. CheckRepoIsClean runs `git status --porcelain` on that tree and treats any output (modified, staged, untracked, or conflicted files) as dirty.

Source

Thrown at tools/inspector_protocol/roll.py:47

]

REVISION_LINE_PREFIX = 'Revision: '

def RunCmd(cmd):
  p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
  (stdoutdata, stderrdata) = p.communicate()
  if p.returncode != 0:
    raise Exception('%s: exit status %d', str(cmd), p.returncode)
  return stdoutdata.decode('utf-8')


def CheckRepoIsClean(path):
  os.chdir(path)  # As a side effect this also checks for existence of the dir.
  # If path isn't a git repo, this will throw and exception.
  # And if it is a git repo and 'git status' has anything interesting to say,
  # then it's not clean (uncommitted files etc.)
  if len(RunCmd(['git', 'status', '--porcelain'])) != 0:
    raise Exception('%s is not a clean git repo (run git status)' % path)


def CheckRepoIsInspectorProtocolCheckout(path):
  os.chdir(path)
  revision = RunCmd(['git', 'config', '--get', 'remote.origin.url']).strip()
  if (revision != 'https://chromium.googlesource.com/deps/inspector_protocol.git'):
    raise Exception('%s is not a proper inspector_protocol checkout: %s' % (path, revision))


def FindFilesToSyncIn(path):
  files = []
  for f in FILES_TO_SYNC:
    files += glob.glob(os.path.join(path, f))
  files = [os.path.relpath(f, path) for f in files]
  return files


def FilesAreEqual(path1, path2):

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Run `git -C <upstream> status` and commit, stash, or discard every change so `git status --porcelain` is empty.
  2. Remove untracked files with `git -C <upstream> clean -fdx` (verify the list first).
  3. Point --ip_src_upstream at a fresh, dedicated clone used only for rolling.

Example fix

// before
python tools/inspector_protocol/roll.py  # upstream tree has edits
// after
git -C ~/ip/src stash && python tools/inspector_protocol/roll.py
Defensive patterns

Strategy: validation

Validate before calling

import subprocess
def upstream_clean(path):
    out = subprocess.run(['git','-C',path,'status','--porcelain'],
                         capture_output=True, text=True)
    return out.returncode == 0 and out.stdout.strip() == ''
assert upstream_clean('~/ip/src')

Prevention

When it happens

Trigger: Invoking `python tools/inspector_protocol/roll.py` while the --ip_src_upstream tree (default ~/ip/src) has local modifications, untracked files, or an in-progress merge/rebase.

Common situations: Leftover edits in the ip checkout after manual testing; build artifacts that became tracked; a previous roll left the tree dirty; pointing --ip_src_upstream at a working clone you also hack on.

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/681db85863336d58. Report an issue: GitHub.