Skip to content

Pitfalls

Scott Singleton edited this page May 12, 2026 · 1 revision

Pitfalls

Real-world traps surfaced during live adoption — the ones that bit hard enough to be worth memorializing. Each entry leads with the symptom, names the cause, and ends with the canonical fix.

Destructive Clean target blast radius

Symptom. A Clean target that globs **/bin and **/obj from RootDirectory runs, then git status shows hundreds or thousands of "deleted" tracked files. On HoldFast's monorepo this wiped 531 tracked files in one run — frontend bins, node_modules/.bin/turbo.cmd, shell scripts under sdk/highlight-next/bin/clean-dist.sh, the works.

Cause. The pattern below looks safe but isn't:

foreach (var d in RootDirectory.GlobDirectories("**/bin", "**/obj")) d.Delete();
Artifacts.Delete();

In a polyglot tree, bin/ and obj/ are not exclusively .NET output. Yarn places bin/ symlink scripts under node_modules/.bin/; many tools ship shell launchers in directories literally named bin/. The glob hits all of them.

Fix (1.1.0+). Use TampBuild.CleanArtifacts():

Target Clean => _ => _.Executes(() => CleanArtifacts());

CleanArtifacts() scopes to Solution.Projects only (no glob across unrelated directories), guards against deleting the running build script's own bin/obj/ (via Assembly.GetEntryAssembly()), and cleans the conventional Artifacts directory. Project-scoped form: CleanArtifacts(RootDirectory / "src" / "MyLib"). Recorded as ADR 0015.

Recovery. If the GlobDirectories pattern is already in your CI and you've shipped a destructive run: git restore . recovers tracked files. The post-disaster yarn recovery below covers the case where Yarn workspace bins were among the casualties.

Yarn berry post-disaster recovery — node_modules/.bin/ missing after a Clean blast

Symptom. After a destructive Clean (above) wipes node_modules/.bin/, partial rm -rf node_modules/<pkg> && yarn install fails to re-extract bin folders even though the package cache (.yarn/cache/*.zip) still contains them. Tamp targets that resolve tools via [FromNodeModules("turbo")] then fail with Tool not found.

Cause. Yarn berry's install-state file (.yarn/install-state.gz) caches the resolved tree. Partial removal + reinstall sees the install-state believing the package is "already installed" and skips the bin-folder extraction, even though the actual bins are gone.

Fix. Full nuke from the workspace root:

rm -rf node_modules .yarn/install-state.gz
yarn install

Takes ~3-4 minutes on a typical monorepo. Bin folders extract correctly afterward and downstream Tamp targets resolve. Don't try to recover incrementally — the install-state file makes that path unreliable.

This is an upstream Yarn behavior, not a Tamp bug. Worth knowing because the most likely reason you're nuking node_modules is that Tamp's Clean wiped your bins.

Buildx migration warnings (informational)

Symptom. Migrating a Build.cs from Tamp.Docker.V27 0.2.x to 0.3.0+, builds suddenly emit warnings they didn't before:

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data
  (ARG "REACT_APP_AUTH_MODE") (line 58)
SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data
  (ENV "REACT_APP_AUTH_MODE") (line 65)

Cause. Docker.Build in 0.3.0+ routes to docker buildx build (BuildKit) by default — modern Dockerfiles using RUN --mount=type=cache, RUN --mount=type=secret, # syntax=docker/dockerfile:1.x frontends, or named build contexts REQUIRE BuildKit. The default reflects the 2026 reality.

BuildKit also runs lint checks the legacy builder didn't. SecretsUsedInArgOrEnv flags any ARG/ENV whose name matches a heuristic pattern (SECRET, PASSWORD, KEY, AUTH, TOKEN). It triggers on the name, not the value — REACT_APP_AUTH_MODE (a non-secret UI display flag) lights it up.

Fix. Three options, pick one:

  1. Rename the ARG/ENV if the name is misleading: REACT_APP_AUTH_MODE → REACT_APP_AUTH_UI_MODE (the latter doesn't match the heuristic).
  2. Use RUN --mount=type=secret if the value really is a secret. Don't put real secrets in ARG/ENV — BuildKit is right to warn.
  3. Ignore the warning if the name is a known false positive in your codebase. BuildKit doesn't fail the build on lint warnings by default.

Reverting to the legacy builder is supported but discouraged — Docker.LegacyBuild routes to docker build (no BuildKit). Use only if your Dockerfile explicitly doesn't use BuildKit-only syntax AND you have a specific reason. The default is correct for almost every codebase.

See also

Clone this wiki locally