Skip to content
Railpack Next.js build fails during output cleanup — possible cache-mount conflict
chrisdelve
OP

a month ago

I'm deploying a Next.js application through Railway using Railpack and Node.js 24.21.

My custom build command invokes a release-validation helper before starting the Next.js build. The helper validates and removes previously generated build output to ensure a clean release.

On Railway, the helper fails while removing the Next.js output directory. Path-containment validation succeeds, but Node's rmSync operation throws.

The sanitized error classification is:

Reason: RELEASE_CHECK_FAILED
Stage: OUTPUT_CLEANUP
Output: NEXT_BUILD_OUTPUT
Operation: REMOVE_OUTPUT
Code: UNKNOWN_FAILURE

The build fails before Next.js compilation begins. No application workload starts.

Confirmed findings:

  • The uploaded source snapshot contains no generated Next.js output or installed dependencies.
  • The release helper passes 20 focused regression tests locally.
  • The effective Railway build and start commands are correct.
  • The failure occurred across multiple Railway builds.
  • Node.js may report certain native removal errors as UV_UNKNOWN.
  • Railpack's Node provider defines a cache location under .next/cache.

Request for assistance:

Could Railway determine whether the failed build mounted a BuildKit/Railpack cache at or beneath the Next.js output directory?

Please confirm the Railpack version used for this deployment and whether its generated plan includes a cache mount at .next/cache.

Is there a supported way to obtain the generated build/mount plan or inspect the underlying native filesystem error?

If .next/cache is mounted inside .next, could recursively removing the parent directory cause this failure?

I want to resolve the problem without weakening release-integrity checks or deleting builder-managed cache mounts.

I can provide the affected deployment ID and sanitized build logs through a private support channel.

Thank you.

0 Replies

Welcome!

Sign in to your Railway account to join the conversation.

Loading...