pcottle/learnGitBranching · error · GitError
git-error-origin-exists
Error message
git-error-origin-exists
What it means
makeOrigin creates the simulated origin repository; it refuses to run when origin already exists, because remotes are single in this app (one 'origin').
Source
Thrown at src/js/git/index.js:387
}, this);
this.tagCollection.each(function(tag) {
this.gitVisuals.addTag(tag);
}, this);
if (tree.originTree) {
var treeString = JSON.stringify(tree.originTree);
// if we don't have an animation queue (like when loading
// right away), just go ahead and make an empty one
this.animationQueue = this.animationQueue || new AnimationQueue({
callback: function() {}
});
this.makeOrigin(treeString);
}
};
GitEngine.prototype.makeOrigin = function(treeString) {
if (this.hasOrigin()) {
throw new GitError({
msg: intl.str('git-error-origin-exists')
});
}
treeString = treeString || this.printTree(this.exportTreeForBranch('main'));
// this is super super ugly but a necessary hack because of the way LGB was
// originally designed. We need to get to the top level visualization from
// the git engine -- aka we need to access our own visuals, then the
// visualization and ask the main vis to create a new vis/git pair. Then
// we grab the gitengine out of that and assign that as our origin repo
// which connects the two. epic
var mainVis = this.gitVisuals.getVisualization();
var originVis = mainVis.makeOrigin({
localRepo: this,
treeString: treeString
});
// defer the starting of our animation until origin has been createdView on GitHub (pinned to 5b09d0ff96)
Solutions
- Skip the second clone — origin is already there
- Reset/reload the level or sandbox before cloning again
- In level code, guard with `if (!engine.hasOrigin())` before makeOrigin
Example fix
// before git clone git clone // after git clone git fetch
Defensive patterns
Strategy: validation
Validate before calling
if (!engine.hasOrigin()) { engine.makeOrigin(); } Prevention
- Clone exactly once per level/sandbox
- Guard level setup code with hasOrigin()
- Reload the level instead of re-cloning
When it happens
Trigger: Calling git clone (or engine.makeOrigin) a second time; some level restarts that re-run clone on an existing remote.
Common situations: Users typing clone twice; level definitions that both clone in their start state and execute a clone command.
Related errors
- cannot fetch to ' + ref + ' when checked out on ' + ref
- ' + ref + ' is not a remote branch
- ' + generalArgs[0] + ' is not a remote in your repository! t
- git-error-origin-required
- <dynamic remote listing>
AI-assisted analysis of pcottle/learnGitBranching@5b09d0ff96 (2026-08-27).
Data as JSON: /api/errors/bcadbba091e9ca81.
Report an issue: GitHub.