GyulyVGC/sniffnet · error · SystemExit
Command failed with exit code
Error message
Command failed with exit code {error.returncode}: {error.cmd} What it means
The __main__ block catches subprocess.CalledProcessError raised by the run() helper (which uses check=True) and re-raises it as SystemExit with the failing command and its exit code. Any external command the script shells out to (git, tar, cargo, dpkg-buildpackage) that exits non-zero produces this message; the command's stderr, if captured, is printed first.
Solutions
- Read the stderr printed above the message to identify the failing command and its cause
- If git rev-parse failed: fetch tags with git fetch --tags and confirm the tag exists (git tag -l 'v*')
- If cargo vendor/metadata failed: verify Cargo.lock matches Cargo.toml at the tagged commit and use a Rust toolchain meeting rust-version (rustup update)
- If dpkg-buildpackage failed: install dpkg-dev and debhelper (sudo apt install dpkg-dev debhelper) and inspect debian/rules for missing build-deps
Example fix
// before
python3 prepare.py --build-source
# stderr: fatal: ambiguous argument 'refs/tags/v1.3.1^{commit}'
// after
git fetch --tags origin
python3 prepare.py --build-source Defensive patterns
Strategy: try-catch
Validate before calling
# pre-flight checks before running the packager
git rev-parse --verify refs/tags/v1.3.1^{commit} || { git fetch --tags; }
cargo --version
tar --version
dpkg-buildpackage --version # only if --build-source will be used Try / catch
import subprocess
try:
prepare(output)
except subprocess.CalledProcessError as error:
if error.stderr:
print(error.stderr, file=sys.stderr)
print(f"Command failed with exit code {error.returncode}: {error.cmd}", file=sys.stderr)
sys.exit(error.returncode) Prevention
- Fetch all tags (git fetch --tags) before packaging a release
- Ensure the Rust toolchain satisfies the project's rust-version
- Install required system tools: git, tar, cargo, and dpkg-buildpackage/debhelper for --build-source
- Read the stderr emitted above this message — it names the exact failing command and underlying cause
- Validate Cargo.lock is committed and consistent with Cargo.toml at the tagged commit
When it happens
Trigger: git rev-parse --verify on a missing tag (refs/tags/vX.Y.Z does not exist); git show on an invalid commit; tar failing to extract the archive; cargo vendor/metadata failing (bad lockfile, missing vendored deps, offline config issues); dpkg-buildpackage failing during --build-source.
Common situations: Running the script on a checkout without the release tag fetched (git fetch --tags); Cargo.lock out of sync with Cargo.toml in the tagged commit; cargo/rust toolchain too old for the project's rust-version; building on a machine missing dpkg-buildpackage/debhelper; network fetch attempts blocked by the forced offline vendored config.
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.
AI-assisted analysis of GyulyVGC/sniffnet@592a62a5ad (2026-09-18).
Data as JSON: /api/errors/367adb59998124e6.
Report an issue: GitHub.
Appendix: source
Thrown at resources/packaging/linux/deb-source/prepare.py:161
parser.add_argument("--output", type=Path, default=ROOT / "target/debian-source")
parser.add_argument("--build-source", action="store_true",
help="also run dpkg-buildpackage to create an unsigned source upload (Linux)")
args = parser.parse_args()
if args.build_source and not shutil.which("dpkg-buildpackage"):
parser.error("--build-source requires dpkg-buildpackage and debhelper")
source = prepare(args.output.resolve())
if args.build_source:
# Build-Depends are needed for the binary build, not source assembly.
run("dpkg-buildpackage", "-S", "-sa", "-us", "-uc", "-d", cwd=source)
if __name__ == "__main__":
try:
main()
except subprocess.CalledProcessError as error:
if error.stderr:
print(error.stderr, file=sys.stderr)
raise SystemExit(f"Command failed with exit code {error.returncode}: {error.cmd}") from error
View on GitHub (pinned to 592a62a5ad)