Troubleshooting
Installation Issues
”command not found: bz”
The bz binary isn’t in your PATH. Solutions:
# Check if it's installedwhich bz
# If using go install, add GOPATH/bin to PATHexport PATH=$PATH:$(go env GOPATH)/bin
# Add to your shell profile (~/.bashrc, ~/.zshrc)echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.zshrcBuild errors from source
Ensure you have Go 1.25 or later:
go versionTry cleaning and rebuilding:
go clean -cachego build -o bz .Configuration Issues
”failed to load config”
The Starlark configuration has a syntax error. Check for:
- Missing commas between function arguments
- Unclosed brackets or parentheses
- Invalid variable names
Run with verbose to see the specific error:
bz mod sync --workflow dev --verbose“undefined: registry”
The registry module isn’t available. This usually means:
- You’re using an invalid function name
- There’s a typo in the module name
Valid registry functions:
registry.http(url)registry.file(path)registry.git(url, branch)registry.http_put(url, auth)“undefined: env”
The env() function requires a string argument:
# Wrongtoken = env(MY_VAR)
# Correcttoken = env("MY_VAR")Environment variable not accessible
By default, only variables with the BZ_ prefix can be accessed. To use other variables, they must be explicitly allowed.
Registry Issues
”module not found”
The module doesn’t exist in the registry. Verify:
# Search for similar namesbz mod search <partial-name>
# Check the exact namebz mod info <exact-name>Common mistakes:
rules-govsrules_go(underscore, not hyphen)- Case sensitivity
”HTTP 404” errors
The URL might be incorrect or the module doesn’t exist at that path. Check:
- Registry URL is correct
- Module path exists
- Version exists
# Test the URL directlycurl -I https://bcr.bazel.build/modules/rules_go/metadata.json”HTTP 403” forbidden
Authentication might be required or incorrect:
# Check your auth configurationregistry.http( url = "https://private.example.com", auth = auth.bearer(token = env("BZ_TOKEN")),)Verify your token is set:
echo $BZ_TOKENTimeout errors
The registry might be slow or unreachable. Options:
- Check network connectivity
- Try again later
- Use a local mirror
Sync Issues
”workflow not found”
The workflow name doesn’t match. Check your config:
sync.workflow( name = "my-workflow", # Use this exact name ...)# List available workflowsbz mod sync --listSync skips all modules
Modules might already exist in the destination. This is expected behavior.
To see what’s happening:
bz mod sync --workflow dev --verboseTo force resync, manually remove the modules from the destination first.
”destination not writable”
Check permissions on the destination:
# For file destinationsls -la /path/to/registry
# Fix permissionschmod -R u+w /path/to/registryGit push fails
For git destinations, check:
- SSH keys or tokens are configured
- You have push access to the repository
- The branch exists or can be created
# Test git accessgit ls-remote https://github.com/myorg/registry.gitPerformance Issues
Sync is slow
Try these optimizations:
-
Reduce versions - Sync only what you need:
versions = sync.latest(count = 3) # Instead of sync.all() -
Reduce modules - Only sync required modules
-
Use dry-run - Preview before actual sync:
Terminal window bz mod sync --workflow dev --dry-run
High memory usage
If syncing many modules/versions, memory usage can grow. Consider:
- Breaking into smaller workflows
- Syncing in batches
Getting Help
If you’re still stuck:
- Check existing GitHub Issues
- Run with
--verboseand include the output when reporting - Include your bz version (
bz --version) - Include relevant parts of your configuration (redact secrets!)