anomalyco/sst · error · VisibleError

TanStack Start assets directory not found at: "${assetsPat

Error message

TanStack Start assets directory not found at:
  "${assetsPath}".

What it means

After validating the server bundle, SST checks the client assets directory referenced by wrangler.json (`assets.directory`, defaulting to `../client`, resolved to `dist/client`). If that directory is missing, SST cannot wire static assets and throws a VisibleError.

Source

Thrown at platform/src/components/cloudflare/tan-stack-start.ts:327

              `TanStack Start build output at "${path.resolve(wranglerPath)}" is missing the Worker entry in \`main\`.`,
            );
          }

          const serverPath = path.resolve(outputPath, "dist", "server", wrangler.main);
          const assetsPath = path.resolve(
            outputPath,
            "dist",
            "server",
            wrangler.assets?.directory ?? "../client",
          );

          if (!(await existsAsync(serverPath))) {
            throw new VisibleError(
              `TanStack Start server bundle not found at:\n  "${serverPath}".`,
            );
          }
          if (!(await existsAsync(assetsPath))) {
            throw new VisibleError(
              `TanStack Start assets directory not found at:\n  "${assetsPath}".`,
            );
          }

          return {
            server: toPlanPath(serverPath),
            assets: toPlanPath(assetsPath),
          };
        }

        for (const serverFile of ["index.js", "index.mjs"]) {
          const serverPath = path.join(
            outputPath,
            "dist",
            "server",
            serverFile,
          );
          const assetsPath = path.join(outputPath, "dist", "client");

View on GitHub (pinned to a0bd20f762)

Solutions

  1. Run the full build so `dist/client` is emitted
  2. Verify/fix `assets.directory` in dist/server/wrangler.json (best via the adapter, not hand edits)
  3. Clean dist and rebuild if the output is partially stale

Example fix

// before: dist/server exists, dist/client missing (client build failed)
rm -rf dist && build full project
// after: dist/client and dist/server both present, sst deploy succeeds
Defensive patterns

Strategy: validation

Validate before calling

import { readFileSync, existsSync } from 'fs';
const w = JSON.parse(readFileSync('apps/web/dist/server/wrangler.json', 'utf8'));
const assets = `apps/web/dist/server/${w.assets?.directory ?? '../client'}`;
if (!existsSync(assets)) throw new Error(`Client assets missing at ${assets}; run the full build`);

Try / catch

try {
  await deploy();
} catch (e) {
  if (/assets directory not found/.test(e.message)) console.error('dist/client missing; run the full client build');
}

Prevention

When it happens

Trigger: A TanStack Start dist build where `dist/server` exists but `dist/client` (or the configured `assets.directory`) does not: client build step skipped/failed, custom assets.directory pointing at a non-existent folder.

Common situations: Running only the server-side part of a multi-step build; CI caching restored only server output; edited wrangler.json assets.directory to a wrong path.

Related errors


AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30). Data as JSON: /api/errors/caf94c6eed866a31. Report an issue: GitHub.