Cache mount "cacheKey prefix missing" error - All documented formats fail
callmeal3x
PROOP

6 months ago

I'm getting this error with cache mounts:

"dockerfile invalid: flag '--mount=type=cache,id=s/...' is missing the cacheKey prefix from its id"

According to docs (https://docs.railway.com/guides/dockerfiles):

--mount=type=cache,id=s/-,target=

WHAT I TRIED (ALL FAILED):

1. Exact doc format with full path:

--mount=type=cache,id=s/f73581c6-c2d7-432a-803d-136b57ce3ce6-/root/.bun/install/cache,target=/root/.bun/install/cache

Error: missing cacheKey prefix

2. Simple name (from community examples):

--mount=type=cache,id=s/f73581c6-c2d7-432a-803d-136b57ce3ce6-bun-cache,target=/root/.bun/install/cache

Error: missing cacheKey prefix

3. Without s/ prefix:

--mount=type=cache,id=f73581c6-c2d7-432a-803d-136b57ce3ce6-bun-cache,target=/root/.bun/install/cache

Error: Cache mount ID is not prefixed with cache key

4. Short name:

--mount=type=cache,id=s/f73581c6-c2d7-432a-803d-136b57ce3ce6-bun,target=/root/.bun/install/cache

Error: missing cacheKey prefix

QUESTIONS:

- Is there a hidden "cacheKey" prefix needed?

- Has the format changed recently?

- Can you provide a working example with real service ID?

ENVIRONMENT:

- Base: oven/bun:1-alpine

- BuildKit: enabled (Railway default)

- Service ID: f73581c6-c2d7-432a-803d-136b57ce3ce6

Every format fails with the same error. Is this feature actually working?

WORKAROUND:

Removed cache mounts, using Docker layer caching only.

$10 Bounty

2 Replies

Railway
BOT

6 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


vikas-gits-good
HOBBY

2 months ago

Hi, I'm facing the same issue. Was anyone able to figure it out?

installing without cache is working though.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...