Error: 'git rev-parse --show-toplevel returned non-zero exit status 128' when running 'pat init' in the Panther Analysis Tool (PAT)

Last updated: March 14, 2026

Issue

When trying to initialize a new Panther Analysis Tool (PAT) project using the pat init command, the following error occurs:

Command '['git', 'rev-parse', '--show-toplevel']' returned non-zero exit status 128.

This error prevents the PAT initialization process from completing successfully.

Resolution

To resolve this issue:

  1. Initialize a Git repository in your current directory by running git init

  2. Run pat init

Cause

This issue occurs when the pat init command is run in a directory that is not yet a Git repository. The Panther Analysis Tool (PAT) expects to run inside an existing Git repository. If the directory has not been initialized with Git, the command fails when it tries to locate the Git repository.