bazelbuild / bazelbuild/bazel

A `file://` registry URI missing a slash leads the "domain" being used as the error message

Open
#24,423 1 comment 0 reactions 0 assignees View on GitHub
help wanted P3 team-Documentation team-ExternalDeps type: bug
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the bug:

It is very easy to neglect adding the extra slash required to produce a valid `file://` URI.

For example;

```
--registry=file://home/coder/work/bazel-central-registry
```

At a glance this looks right, but at runtime you'll end up with an error like the following.

```
ERROR: Error accessing registry file://home/coder/work/bazel-central-registry: Failed to fetch registry file file://home/coder/work/bazel-central-registry/modules/protobuf/25.3/MODULE.bazel: home. Type 'bazel help mod' for syntax and help.
```

The only hint as to the cause is the first path segment being the error message, otherwise this is a poor error message that doesn't actually explain what went wrong.

The correct argument would have been;

```
--registry=file:///home/coder/work/bazel-central-registry
^
```

### Which category does this issue belong to?

Documentation, External Dependency

### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

_No response_

### Which operating system are you running Bazel on?

Linux (Ubuntu)

### What is the output of `bazel info release`?

release 7.4.1

### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.

_No response_

### What's the output of `git remote get-url origin; git rev-parse HEAD` ?

_No response_

### If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

_No response_

### Have you found anything relevant by searching the web?

_No response_

### Any other information, logs, or outputs that you want to share?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the error with the --registry=file://home/coder/work/bazel-central-registry argument and compare it with the corrected file:/// form. Trace Bazel's registry URI handling used by bazel help mod; done means the malformed URI produces a clear explanation instead of reporting "home" as the error message.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.