diff --git a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleFileFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleFileFunction.java index 9eac3c8c86d800..0fd2f279476378 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleFileFunction.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleFileFunction.java @@ -199,7 +199,8 @@ private Optional getModuleFile(ModuleKey key, StarlarkOverr ImmutableList.Builder registryObjects = new ImmutableList.Builder<>(); for (String registryUrl : registries) { try { - registryObjects.add(registryFactory.getRegistryWithUrl(registryUrl)); + registryObjects.add(registryFactory.getRegistryWithUrl( + registryUrl.replace("%workspace%", workspaceRoot.getPathString()))); } catch (URISyntaxException e) { throw new ModuleFileFunctionException(e); }