Skip to content

Common Issues

Solutions to frequently encountered Copybara problems.

Error MessageJump To
No changes to migrateNo changes
Authentication failedAuth issues
Permission deniedPermissions
Unknown fieldConfig errors
Missing required fieldConfig errors
Invalid glob patternGlob errors
GitOrigin-RevId not foundState issues
Pattern not foundTransform errors
verify_match failedVerification
OutOfMemoryErrorMemory issues
Branch already existsPR issues
rate limit exceededRate limiting

Cause: No new commits since last sync.

Solutions:

  1. Use --ignore-noop to not fail:

    Terminal window
    java -jar copybara.jar migrate copy.bara.sky export --ignore-noop
  2. Force re-sync:

    Terminal window
    java -jar copybara.jar migrate copy.bara.sky export --force
  3. Start from specific commit:

    Terminal window
    java -jar copybara.jar migrate copy.bara.sky export --last-rev abc123

Cause: Invalid or missing credentials.

Check credentials:

Terminal window
# Test Git access
git ls-remote https://github.com/org/repo
# Check stored credentials
cat ~/.git-credentials

Fix for HTTPS:

Terminal window
git config --global credential.helper store
echo "https://x-access-token:${TOKEN}@github.com" > ~/.git-credentials

Fix for SSH:

Terminal window
ssh-add ~/.ssh/id_ed25519
ssh -T git@github.com

Cause: Token lacks required permissions.

For GitHub:

  • Classic PAT: needs repo scope
  • Fine-grained: needs Contents (RW), Pull requests (RW)

For PRs:

  • Verify you have write access to destination repo
  • Check branch protection rules
Error: Unknown field 'unknown_field' in core.workflow

Fix: Check spelling, consult documentation for valid fields.

Error: Missing required field 'authoring' in core.workflow

Fix: Add the required field:

authoring = authoring.pass_thru("Bot <bot@example.com>"),
Error: Invalid glob pattern: [**

Fix: Ensure patterns are valid:

glob(["**"]) # Correct
glob("[**") # Invalid

Cause: GitOrigin-RevId mismatch.

Check current state:

Terminal window
git log --grep="GitOrigin-RevId" -1

Reset state:

Terminal window
java -jar copybara.jar migrate copy.bara.sky export --last-rev <known-good-sha>

Cause: Manual commits in destination without marker.

Fix: Use --last-rev to specify starting point.

Error: Pattern 'old_text' not found

Cause: core.replace pattern doesn’t match anything.

Fix: Verify pattern exists in source files or add error handling.

Error: Pattern 'SECRET' found in files

Cause: verify_no_match = True but pattern was found.

Fix: Remove the sensitive content from source or adjust pattern.

Cause: Previous sync branch wasn’t cleaned up.

Fix: Delete the branch and retry:

Terminal window
git push origin --delete copybara/sync-xyz

This is normal - Copybara updates existing PRs.

Cause: Processing entire history.

Fix: Use --last-rev to start from recent commit:

Terminal window
java -jar copybara.jar migrate copy.bara.sky export --last-rev HEAD~100

Cause: Large repository or many files.

Fix: Increase Java heap:

Terminal window
java -Xmx4g -jar copybara.jar migrate copy.bara.sky export

Symptoms:

  • rate limit exceeded
  • API rate limit exceeded for user
  • HTTP 429 responses

Cause: Too many API calls to GitHub/GitLab.

Solutions:

  1. Add delays between operations:

    Terminal window
    # Simple rate limiting wrapper
    sleep 60 && java -jar copybara.jar migrate copy.bara.sky
  2. Use authenticated requests (higher limits):

    Terminal window
    # GitHub: 5000 requests/hour authenticated vs 60 unauthenticated
    export GITHUB_TOKEN="ghp_..."
  3. Reduce sync frequency in CI:

    on:
    schedule:
    - cron: "0 */6 * * *" # Every 6 hours instead of every push
  4. Check current rate limit status:

    Terminal window
    curl -H "Authorization: token $GITHUB_TOKEN" \
    https://api.github.com/rate_limit