Description
packages/react-native/scripts/react_native_pods_utils/script_phases.sh defines:
error () {
echo "$1"
"[Codegen] $1" >> "${SCRIPT_OUTPUT_FILE_0}" 2>&1
exit 1
}
The second line does not append a log message. It attempts to execute a command whose name is the formatted error string.
In practice this means:
- the helper can fail with
command not found before reaching the intended exit 1 when set -e is active
SCRIPT_OUTPUT_FILE_0 receives the shell error instead of the intended [Codegen] ... log line
- multi-part messages are truncated because the function only prints
$1
This looks like a regression introduced when the script was extracted into script_phases.sh in commit 1dbbeb4462e67ffecf0a4634cf3eb039886e21a2 (Move script_phases script out of ruby file.). The earlier inline implementation in scripts/react_native_pods.rb wrote the message directly to SCRIPT_OUTPUT_FILE_0 and did not attempt to execute it.
Steps to reproduce
- Check the current
main branch source.
- Run this standalone shell repro:
bash -lc 'set -e; rm -f /tmp/rn-codegen-test.log; f(){ echo "$1"; "[Codegen] $1" >> /tmp/rn-codegen-test.log 2>&1; echo after; }; f hello'
- Observe that the shell exits with status
127 before echo after runs.
- Inspect
/tmp/rn-codegen-test.log and observe that it contains a shell error (command not found) rather than the intended [Codegen] hello message.
React Native Version
main at b32a6c9e9db (observed on May 24, 2026)
Affected Platforms
- Runtime - iOS
- Build - MacOS
Output of npx @react-native-community/cli info
N/A. This is a source-level bug in a repository shell script and can be reproduced with the standalone shell command above.
Stacktrace or Logs
Example repro output:
The shell exits with status 127, and /tmp/rn-codegen-test.log contains:
bash: [Codegen] hello: command not found
MANDATORY Reproducer
The standalone shell repro above is minimal and does not require a separate sample app or external library.
Screenshots and Videos
N/A
Suggested fix
error () {
message="$*"
echo "$message"
echo "[Codegen] $message" >> "${SCRIPT_OUTPUT_FILE_0}" 2>&1
exit 1
}
Description
packages/react-native/scripts/react_native_pods_utils/script_phases.shdefines:The second line does not append a log message. It attempts to execute a command whose name is the formatted error string.
In practice this means:
command not foundbefore reaching the intendedexit 1whenset -eis activeSCRIPT_OUTPUT_FILE_0receives the shell error instead of the intended[Codegen] ...log line$1This looks like a regression introduced when the script was extracted into
script_phases.shin commit1dbbeb4462e67ffecf0a4634cf3eb039886e21a2(Move script_phases script out of ruby file.). The earlier inline implementation inscripts/react_native_pods.rbwrote the message directly toSCRIPT_OUTPUT_FILE_0and did not attempt to execute it.Steps to reproduce
mainbranch source.bash -lc 'set -e; rm -f /tmp/rn-codegen-test.log; f(){ echo "$1"; "[Codegen] $1" >> /tmp/rn-codegen-test.log 2>&1; echo after; }; f hello'127beforeecho afterruns./tmp/rn-codegen-test.logand observe that it contains a shell error (command not found) rather than the intended[Codegen] hellomessage.React Native Version
mainatb32a6c9e9db(observed on May 24, 2026)Affected Platforms
Output of
npx @react-native-community/cli infoN/A. This is a source-level bug in a repository shell script and can be reproduced with the standalone shell command above.
Stacktrace or Logs
Example repro output:
The shell exits with status
127, and/tmp/rn-codegen-test.logcontains:MANDATORY Reproducer
The standalone shell repro above is minimal and does not require a separate sample app or external library.
Screenshots and Videos
N/A
Suggested fix