hermes - 💡(How to fix) Fix [Bug]: scripts/run_tests.sh fails with no args on macOS Bash 3.2 [3 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Additional Logs / Traceback (optional)

Root Cause

Root Cause Analysis (optional)

Fix Action

Fixed

Code Example

scripts/run_tests.sh: line 98: ARGS[@]: unbound variable
This affects the default/recommended test command for contributors when using the Bash version that ships with macOS.

---

/bin/bash --version

---

GNU bash, version 3.2.57(1)-release (arm64-apple-darwin24)

---

cd hermes-agent
scripts/run_tests.sh

---

N/A. This fails in scripts/run_tests.sh before Hermes runtime/debug logs are involved.

---

scripts/run_tests.sh: line 98: ARGS[@]: unbound variable

---

set -euo pipefail

---

ARGS=("$@")

---

"${ARGS[@]}"

---

GNU bash, version 3.2.57(1)-release (arm64-apple-darwin24)

---

PYTEST_CMD=(
  "$PYTHON" -m pytest
  -o "addopts="
  -n "$WORKERS"
  --ignore=tests/integration
  --ignore=tests/e2e
  -m "not integration"
)

if [ "$#" -gt 0 ]; then
  PYTEST_CMD+=("${ARGS[@]}")
fi

exec "${PYTEST_CMD[@]}"
RAW_BUFFERClick to expand / collapse

Bug Description

Running scripts/run_tests.sh with no arguments fails on macOS system Bash 3.2 before pytest is invoked.

The failure is:

scripts/run_tests.sh: line 98: ARGS[@]: unbound variable
This affects the default/recommended test command for contributors when using the Bash version that ships with macOS.

This affects stock macOS environments where env bash resolves to Apple’s system Bash 3.2.x.

Steps to Reproduce

  1. Use macOS with the system Bash:
/bin/bash --version

Example:

GNU bash, version 3.2.57(1)-release (arm64-apple-darwin24)
  1. From a Hermes checkout with dependencies installed, run:
cd hermes-agent
scripts/run_tests.sh
  1. The script exits before running pytest.

Expected Behavior

scripts/run_tests.sh should run the default test suite when invoked without arguments.

Actual Behavior

▶ running pytest with 4 workers, hermetic env, in ****/NousResearch/hermes-agent (TZ=UTC LANG=C.UTF-8 PYTHONHASHSEED=0; all credential env vars unset) scripts/run_tests.sh: line 98: ARGS[@]: unbound variable

Affected Component

Other

Messaging Platform (if gateway-related)

N/A (CLI only)

Debug Report

N/A. This fails in scripts/run_tests.sh before Hermes runtime/debug logs are involved.

Operating System

macOS 15 / Darwin 24, Apple Silicon

Python Version

Python 3.13.3

Hermes Version

Hermes Agent v0.13.0 (2026.5.7)

Additional Logs / Traceback (optional)

scripts/run_tests.sh: line 98: ARGS[@]: unbound variable

Root Cause Analysis (optional)

run_tests.sh enables strict mode:

set -euo pipefail

It then stores script arguments in a Bash array:

ARGS=("$@")

and later unconditionally expands it:

"${ARGS[@]}"

When the script is invoked with no arguments, macOS Bash 3.2 treats this empty array expansion under set -u as an unbound variable, causing the script to exit before pytest is invoked.

This is reproducible with the Bash version bundled with macOS:

GNU bash, version 3.2.57(1)-release (arm64-apple-darwin24)

Proposed Fix (optional)

Avoid expanding the argument array when no user arguments were provided.

One possible fix is to build the pytest command in an array and append user arguments only when $# > 0:

PYTEST_CMD=(
  "$PYTHON" -m pytest
  -o "addopts="
  -n "$WORKERS"
  --ignore=tests/integration
  --ignore=tests/e2e
  -m "not integration"
)

if [ "$#" -gt 0 ]; then
  PYTEST_CMD+=("${ARGS[@]}")
fi

exec "${PYTEST_CMD[@]}"

This preserves existing behavior when arguments are provided, while allowing the no-argument default test run to work on macOS Bash 3.2.

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix [Bug]: scripts/run_tests.sh fails with no args on macOS Bash 3.2 [3 pull requests]