diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkRepositoryModule.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkRepositoryModule.java index cf1b9199f6b819..ba95418a06eea5 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkRepositoryModule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkRepositoryModule.java @@ -220,6 +220,9 @@ private Object createRuleLegacy(StarlarkThread thread, Dict kwar // TODO(adonovan): is this cast safe? Check. String name = (String) kwargs.get("name"); + if (name == null) { + throw Starlark.errorf("argument 'name' is required"); + } WorkspaceFactoryHelper.addMainRepoEntry(packageBuilder, name); WorkspaceFactoryHelper.addRepoMappings(packageBuilder, kwargs, name); return WorkspaceFactoryHelper.createAndAddRepositoryRule(