Root CauseWhat broke, why, and the fix.

bash unbound variable hid a release job that packaged the wrong source tree

· Bash, release engineering, debugging
ⓘ Operated by TechAthletes. Every post here is a bug we hit in our own work — symptom, root cause, fix. Nothing is sponsored and we are not paid to mention any tool.

Key points

  • A release reported success, but the downloaded package lacked the workspace feature added that day. The tests and packager used different source trees. (Source: our own measurement, 2026-09-13)
  • Five variable references followed immediately by non-ASCII characters caused the Bash script to fail under set -u. The configured automation had no successful release history. (Source: our own measurement, 2026-09-13)
  • Synchronizing committed source fixed one mismatch but still excluded replacement images and dependency modules that had never been committed. (Source: our own measurement, 2026-09-13)
  • Downloading the package and comparing image bytes exposed a defect that file listings had missed. The resulting check also rejected a quarantined defective package. (Source: our own measurement, 2026-09-13)

A successful release message led to a package with old code

On September 13, 2026, the first production execution of our automated release script appeared to succeed. Its output included:

✅ v1.0.9 shipped

The package downloaded from Google Cloud Storage told a different story. It did not contain the workspace feature added that day: workspaces.js, six MCP tools, and support for 19 languages were missing. Old code had been distributed with a new version number.

The discrepancy was concrete. The release message said the operation had completed, while the delivered files lacked the expected implementation. Reading the message again could not settle that disagreement. Inspecting the distributed package exposed it.

The investigation then uncovered several separate failures. The quality gate and packager read different source trees. The scheduled script had previously failed before producing releases. Its saved state would also have treated its own version update as a new change on the next run.

These failures needed separate corrections. Making the shell script execute would not make its source selection correct. Correcting source selection would not make its saved state accurate. And, as a later download demonstrated, copying committed source would not include changes that existed only in a working tree.

Source: our own measurement, 2026-09-13.

The schedule and green tests supported assumptions the artifact contradicted

The quality gate ran against the development directory on Drive and reported 445 passing Jest tests. The packager’s SRC, however, pointed to a separate clone outside Drive.

That clone received updates through the GitHub origin. The development branch on Drive contained 338 unpushed commits, so those commits had not reached the clone through that route. The tests therefore described one tree, while the distributed package came from another.

A source-tree mismatch is a release condition in which the quality gate checks one set of source files while the packager builds from another.

That definition captures the boundary this release crossed. The test result was real, but it did not establish the contents of the other directory. The missing workspace files were evidence of the consequence: the new work existed on the tested side without appearing in the package.

There was a second unsupported assumption about the automation itself. A daily run had been configured for 04:40, but the release history contained no automated releases. It showed only a manual release on August 8.

Configuration established an intended schedule. It did not establish that the scheduled operation had ever shipped anything. The absence of successful automated release records mattered because the script contained a failure that prevented it from completing.

The package download and release history answered different questions. One showed what had actually been distributed. The other showed whether the supposed recurring process had a record of successful execution. Neither answer could be obtained from the schedule alone.

Source: our own measurement, 2026-09-13.

The Bash failure and saved hash added independent defects

The shell failure involved variable references immediately followed by full-width characters. The recorded form included:

v$VERSION)

The observed error was:

VERSION�: unbound variable

The investigation recorded Bash incorporating the first byte of the following multibyte character into the variable name. With set -u enabled, the script stopped. A mechanical search found five affected locations.

The correction changed each affected $VAR reference to ${VAR}. For the recorded example, that makes the variable boundary explicit:

v${VERSION})

This explained why the daily job’s configuration had not translated into a successful release history. There was an executable failure in the script, not merely a missing confirmation message.

A dry run exposed another defect after that issue was addressed. The script changed the version in package.json after shipping, but saved a treeHash calculated before the version change. The saved hash therefore did not describe the final tree.

On the next execution, the script would identify a change caused by its own previous version update. The recorded sequence would advance to 1.0.11, then 1.0.12, and continue increasing the version each morning. This was discovered in a dry run; it was not a history of releases that had already occurred.

The fix recalculated the tree hash after rewriting the version and then saved the resulting state. A production-mode execution was observed to exit silently after this correction.

Each defect affected a different part of the process: whether the script could run, which files it packaged, and whether it could recognize that no further release was needed.

The first repair still shipped images that had never been replaced in Git

The source correction copied the committed application subtree from the Drive development branch into the packaging clone, then committed and pushed that synchronization. This aligned the source intended for testing and packaging.

The package was issued again as 1.0.10. A download from Google Cloud Storage was checked for workspaces.js, two move_tile occurrences, and 19 languages. The Firestore product record was also confirmed to point to 1.0.10.

That verification was still incomplete.

For the image assets, the initial inspection used:

unzip -l

The listing showed 16 face-image entries and no LICENSE-ASSETS entries. The contents of the face images were not inspected. An initial conclusion that no third-party material remained was subsequently overturned by another inspection of the downloaded ZIP.

An MD5 comparison matched f0.jpg to an old image from a June 11 commit. The recorded match was:

f0.jpg = 602b7b43…

Those older files were photographs with an unknown source. The intended replacements, covering 37 files on September 7, had existed only in the working tree and had never been committed. Four dependency modules were also untracked.

Copying committed source therefore reproduced the older committed assets. It could not carry the replacement files that were absent from that committed state. This was a further boundary inside the original source problem: the files visible during development were not all represented in the Git source used for release.

The replacements were committed. Versions 1.0.9 and 1.0.10 were moved into quarantine, and the corrected package was issued using 1.0.9 again.

This time, the downloaded image files were compared by bytes. All 16 matched the intended originals, and none matched the old images. The release script gained a content check covering the intended face images, the absence of old images, and the existence of the dependency modules.

The check was also run against the quarantined 1.0.10 package. It terminated after detecting 16 old images. That negative test demonstrated that the new verification rejected the specific defective artifact already found in distribution.

Source: our own measurement, 2026-09-13.

The lesson: verify each boundary against the files it actually handles

This incident leaves a set of checks that can be repeated in another release environment.

First, compare the directory used by the quality gate with the source directory used by the packager. In this case, passing tests described the development tree while packaging consumed a separate clone. Checking those locations directly would have exposed the mismatch that the successful test output could not resolve.

Next, inspect the release history when evaluating whether an automated job is operating. Here, a configured daily schedule coexisted with no successful automated releases. The Bash error explained that gap. For the recorded shell pattern, the concrete repair was to put braces around variable names immediately followed by non-ASCII text.

Then inspect the committed state that the release actually consumes. The source synchronization copied commits, while the intended image replacements remained outside those commits. The untracked dependency modules were another reason to check that required files were represented in the release source.

Finally, download the delivered package and verify the properties that matter. A file listing established that image entries existed. It did not establish that those entries contained the intended images. Byte comparison answered that narrower, decisive question.

The eventual automated check came from the manual procedure that exposed the defect. It checked image contents and required modules, then proved useful against a known bad package. That made the verification reviewable through both a corrected artifact and a rejected defective one.

The release message, test results, committed tree, file listing, and byte comparison each described something different. The failure persisted wherever one was accepted as evidence for another. The completed repair connected those checks to the actual source and downloaded files they were meant to verify.

Further reading

The gap this incident fell through is exactly what set -u and bash's variable-expansion rules are for. Learning the bash Shell (Cameron Newham) covers that behavior, including the unbound-variable handling this post turned on.

Advertisement: the book is listed on Amazon. As an Amazon Associate I earn from qualifying purchases.

Root Cause is written while shipping small software products — you can see them at TechAthletes.

All posts →

Get new posts by email

We email you only when a new post goes up here. You can unsubscribe at any time.

Privacy policy