Troubleshooting
This guide covers common issues you might encounter and how to resolve them.
Diagnostic First Step
Always start with:
rung doctorThis checks stack integrity, git state, sync state, and GitHub connectivity.
Common Issues
”Not a rung repository”
Symptom:
Error: Not a rung repository. Run `rung init` first.Cause: Rung hasn’t been initialized in this repository.
Solution:
rung init“Current branch is not in stack”
Symptom:
Error: Current branch 'feature-x' is not part of a rung stack.Cause: You’re on a branch that wasn’t created with rung create.
Solutions:
-
Create a new branch with rung:
Terminal window git checkout mainrung create feature-x-newgit cherry-pick <commits-from-feature-x> -
Or work without rung on this branch.
”Authentication failed”
Symptom:
Error: Could not authenticate with GitHubCause: No valid GitHub token found.
Solutions:
-
Use GitHub CLI:
Terminal window gh auth login -
Or set environment variable:
Terminal window export GITHUB_TOKEN=ghp_your_token_here
“Branch not found”
Symptom:
Error: Branch 'feature-old' not foundCause: A branch in the stack was deleted outside of rung.
Solution:
-
Remove from stack manually:
Terminal window # Edit .git/rung/stack.json and remove the entry -
Or recreate the branch:
Terminal window git checkout -b feature-old origin/feature-old
“Sync state exists but not in rebase”
Symptom:
Error: Sync state exists but git is not in a rebaseCause: A previous sync was interrupted abnormally.
Solution:
rm .git/rung/sync_state.jsonrung sync“No backup found”
Symptom:
Error: No backup found. Nothing to undo.Cause: No sync has been performed, or backups were deleted.
Solution:
Use git reflog to find previous commit:
git reflog show feature-branchgit reset --hard feature-branch@{1}“PR base branch mismatch”
Symptom: PR has wrong base branch on GitHub.
Cause: Stack changed but PRs weren’t updated.
Solution:
rung submitThis updates all PR base branches.
”Force push rejected”
Symptom:
Error: Remote has changes. Use --force to overwrite.Cause: Someone else pushed to your branch, or the remote diverged.
Solutions:
-
If your local is correct:
Terminal window rung submit --force -
If you need to merge remote changes:
Terminal window git pull origin feature-branch# Resolve any conflictsrung submit
“Circular dependency detected”
Symptom:
Error: Circular dependency: a -> b -> c -> aCause: Stack definition has a cycle.
Solution:
Edit .git/rung/stack.json to fix the parent relationships:
code .git/rung/stack.json“Working directory not clean”
Symptom:
Error: Working directory has uncommitted changesCause: You have uncommitted changes that would conflict with sync.
Solution:
# Option 1: Commit changesgit add . && git commit -m "WIP"
# Option 2: Stash changesgit stashrung syncgit stash popGit State Issues
Detached HEAD
Symptom:
Error: Not on a branch (detached HEAD)Solution:
git checkout feature-branchRebase in Progress
Symptom:
Error: A rebase is already in progressSolution:
# Continue the rebasegit rebase --continue
# Or abort itgit rebase --abortMerge in Progress
Symptom:
Error: A merge is in progressSolution:
# Complete the mergegit add . && git commit
# Or abort itgit merge --abortPerformance Issues
Slow Status
Symptom: rung status takes several seconds.
Possible causes:
- Large repository
- Many branches in stack
Solutions:
- Keep stacks small (3-5 branches)
- Ensure your repository is not excessively large
Slow Sync
Symptom: rung sync is slow.
Possible causes:
- Many commits to rebase
- Large files in commits
- Complex merge conflicts
Solutions:
- Keep commits small
- Sync frequently to reduce rebased commits
- Consider squashing old commits before syncing
Recovery Procedures
Complete Reset
If everything is broken, start fresh:
# Backup your stack definitioncp .git/rung/stack.json ~/stack-backup.json
# Remove rung staterm -rf .git/rung
# Re-initializerung init
# Restore stack (if needed)cp ~/stack-backup.json .git/rung/stack.jsonRecover Branch from Reflog
# Find the commitgit reflog show feature-branch
# Reset to itgit checkout feature-branchgit reset --hard feature-branch@{2}Recover from Bad Merge
If rung merge caused problems:
# Find pre-merge stategit reflog show feature-branch
# Reset branchesgit checkout feature-branchgit reset --hard <commit-before-merge>Inspecting State
You can examine rung’s state files directly:
# Stack definitioncat .git/rung/stack.json | jq .
# Backup refsls -la .git/rung/refs/
# Sync state (only exists during conflicts)cat .git/rung/sync_state.json | jq .Getting Help
If you can’t resolve an issue:
- Check the FAQ
- Search GitHub Issues
- Open a new issue with:
rung doctor --jsonoutput- Steps to reproduce
- Expected vs actual behavior
Related
- Doctor command — Diagnostic tool
- State management — Understanding rung’s data
- FAQ — Frequently asked questions