Skip to content

Common Issues

Solutions to frequently encountered Copybara problems.

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