dify - 💡(How to fix) Fix make type-check-core fails on macOS Bash 3.2 when PATH_TO_CHECK is empty

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…

Running make type-check-core with no PATH_TO_CHECK fails before pyrefly runs on macOS's default Bash 3.2.

The failure appears to come from dev/pyrefly-check-local expanding an empty array while set -u is enabled:

📝 Running core type checks (pyrefly + mypy)...
./dev/pyrefly-check-local: line 38: target_paths[@]: unbound variable
make: *** [type-check-core] Error 1

Error Message

make: *** [type-check-core] Error 1

Root Cause

Running make type-check-core with no PATH_TO_CHECK fails before pyrefly runs on macOS's default Bash 3.2.

The failure appears to come from dev/pyrefly-check-local expanding an empty array while set -u is enabled:

📝 Running core type checks (pyrefly + mypy)...
./dev/pyrefly-check-local: line 38: target_paths[@]: unbound variable
make: *** [type-check-core] Error 1

Fix Action

Workaround

Passing an explicit path avoids the empty-array expansion:

make type-check-core PATH_TO_CHECK=api

Code Example

📝 Running core type checks (pyrefly + mypy)...
./dev/pyrefly-check-local: line 38: target_paths[@]: unbound variable
make: *** [type-check-core] Error 1

---

/bin/bash --version
make type-check-core

---

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

---

./dev/pyrefly-check-local

---

dev/pyrefly-check-local: line 38: target_paths[@]: unbound variable

---

target_paths=()
...
uv run --directory api --dev pyrefly check "${pyrefly_args[@]}" "${target_paths[@]}" >"$tmp_output" 2>&1

---

/bin/bash -u -c 'a=(); printf "<%s>\n" "${a[@]}"; echo ok'
# /bin/bash: a[@]: unbound variable

---

make type-check-core PATH_TO_CHECK=api
RAW_BUFFERClick to expand / collapse

Description

Running make type-check-core with no PATH_TO_CHECK fails before pyrefly runs on macOS's default Bash 3.2.

The failure appears to come from dev/pyrefly-check-local expanding an empty array while set -u is enabled:

📝 Running core type checks (pyrefly + mypy)...
./dev/pyrefly-check-local: line 38: target_paths[@]: unbound variable
make: *** [type-check-core] Error 1

Steps to reproduce

On macOS using the system /bin/bash:

/bin/bash --version
make type-check-core

Observed Bash version:

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

make -n type-check-core shows the pyrefly script is called without a target path when PATH_TO_CHECK is unset:

./dev/pyrefly-check-local

Expected behavior

make type-check-core should run the full core type check when PATH_TO_CHECK is omitted, preserving the previous default behavior.

Actual behavior

The script exits immediately with:

dev/pyrefly-check-local: line 38: target_paths[@]: unbound variable

Suspected cause

This looks related to commit af4b9bfa8f3e200f5e910e6d1dae81a45bb84f4d / PR #36154 (chore: Remove pyright in favor of pyrefly), which added optional target path forwarding:

target_paths=()
...
uv run --directory api --dev pyrefly check "${pyrefly_args[@]}" "${target_paths[@]}" >"$tmp_output" 2>&1

On Bash 3.2, expanding an empty array with set -u raises unbound variable:

/bin/bash -u -c 'a=(); printf "<%s>\n" "${a[@]}"; echo ok'
# /bin/bash: a[@]: unbound variable

Possible fix

Only append target_paths when it is non-empty, for example by building the command conditionally or using a separate array that is only expanded after checking ${#target_paths[@]}.

Workaround

Passing an explicit path avoids the empty-array expansion:

make type-check-core PATH_TO_CHECK=api

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…

FAQ

Expected behavior

make type-check-core should run the full core type check when PATH_TO_CHECK is omitted, preserving the previous default behavior.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

dify - 💡(How to fix) Fix make type-check-core fails on macOS Bash 3.2 when PATH_TO_CHECK is empty