2 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/<service id>-<target path>,target=<target path>
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.
1 Replies
2 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!

