Common Issues
Common Issues
Section titled “Common Issues”Solutions to frequently encountered Copybara problems.
”No changes to migrate”
Section titled “”No changes to migrate””Cause: No new commits since last sync.
Solutions:
-
Use
--ignore-noopto not fail:Terminal window java -jar copybara.jar migrate copy.bara.sky export --ignore-noop -
Force re-sync:
Terminal window java -jar copybara.jar migrate copy.bara.sky export --force -
Start from specific commit:
Terminal window java -jar copybara.jar migrate copy.bara.sky export --last-rev abc123
Authentication Failed
Section titled “Authentication Failed”Cause: Invalid or missing credentials.
Check credentials:
# Test Git accessgit ls-remote https://github.com/org/repo
# Check stored credentialscat ~/.git-credentialsFix for HTTPS:
git config --global credential.helper storeecho "https://x-access-token:${TOKEN}@github.com" > ~/.git-credentialsFix for SSH:
ssh-add ~/.ssh/id_ed25519ssh -T git@github.comPermission Denied
Section titled “Permission Denied”Cause: Token lacks required permissions.
For GitHub:
- Classic PAT: needs
reposcope - Fine-grained: needs Contents (RW), Pull requests (RW)
For PRs:
- Verify you have write access to destination repo
- Check branch protection rules
Configuration Errors
Section titled “Configuration Errors””Unknown field”
Section titled “”Unknown field””Error: Unknown field 'unknown_field' in core.workflowFix: Check spelling, consult documentation for valid fields.
”Missing required field”
Section titled “”Missing required field””Error: Missing required field 'authoring' in core.workflowFix: Add the required field:
authoring = authoring.pass_thru("Bot <bot@example.com>"),“Invalid glob pattern”
Section titled ““Invalid glob pattern””Error: Invalid glob pattern: [**Fix: Ensure patterns are valid:
glob(["**"]) # Correctglob("[**") # InvalidState Issues
Section titled “State Issues”Wrong state / duplicate syncs
Section titled “Wrong state / duplicate syncs”Cause: GitOrigin-RevId mismatch.
Check current state:
git log --grep="GitOrigin-RevId" -1Reset state:
java -jar copybara.jar migrate copy.bara.sky export --last-rev <known-good-sha>Missing GitOrigin-RevId
Section titled “Missing GitOrigin-RevId”Cause: Manual commits in destination without marker.
Fix: Use --last-rev to specify starting point.
Transform Errors
Section titled “Transform Errors””Pattern not found”
Section titled “”Pattern not found””Error: Pattern 'old_text' not foundCause: core.replace pattern doesn’t match anything.
Fix: Verify pattern exists in source files or add error handling.
”verify_match failed”
Section titled “”verify_match failed””Error: Pattern 'SECRET' found in filesCause: verify_no_match = True but pattern was found.
Fix: Remove the sensitive content from source or adjust pattern.
PR Destination Issues
Section titled “PR Destination Issues””Branch already exists”
Section titled “”Branch already exists””Cause: Previous sync branch wasn’t cleaned up.
Fix: Delete the branch and retry:
git push origin --delete copybara/sync-xyz“PR already exists”
Section titled ““PR already exists””This is normal - Copybara updates existing PRs.
Performance Issues
Section titled “Performance Issues”Slow initial sync
Section titled “Slow initial sync”Cause: Processing entire history.
Fix: Use --last-rev to start from recent commit:
java -jar copybara.jar migrate copy.bara.sky export --last-rev HEAD~100Memory issues
Section titled “Memory issues”Cause: Large repository or many files.
Fix: Increase Java heap:
java -Xmx4g -jar copybara.jar migrate copy.bara.sky export