Unable to update Bench - basename $(git symbolic-ref -q HEAD)' returned non-zero exit status 1

Trying to update Bench on my site. i was unable to do it via CLI so i installed the Bench Manager on my site. The Error Message is as follows:

ERROR: Command ‘basename $(git symbolic-ref -q HEAD)’ returned non-zero exit status 1.
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 8, in
File “/usr/local/lib/python3.10/dist-packages/bench/cli.py”, line 127, in cli
File “/usr/lib/python3/dist-packages/click/core.py”, line 1128, in call
return self.main(*args, **kwargs)
File “/usr/lib/python3/dist-packages/click/core.py”, line 1053, in main
rv = self.invoke(ctx)
File “/usr/lib/python3/dist-packages/click/core.py”, line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/lib/python3/dist-packages/click/core.py”, line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/lib/python3/dist-packages/click/core.py”, line 754, in invoke
return __callback(*args, **kwargs)
File “/usr/local/lib/python3.10/dist-packages/bench/commands/update.py”, line 59, in update
File “/usr/local/lib/python3.10/dist-packages/bench/utils/bench.py”, line 418, in update
File “/usr/local/lib/python3.10/dist-packages/bench/utils/bench.py”, line 612, in validate_branch
branch = get_current_branch(app)
File “/usr/local/lib/python3.10/dist-packages/bench/utils/app.py”, line 175, in get_current_branch
return get_cmd_output(“basename $(git symbolic-ref -q HEAD)”, cwd=repo_dir)
File “/usr/local/lib/python3.10/dist-packages/bench/utils/init.py”, line 217, in get_cmd_output
output = subprocess.check_output(
File “/usr/lib/python3.10/subprocess.py”, line 420, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File “/usr/lib/python3.10/subprocess.py”, line 524, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command ‘basename $(git symbolic-ref -q HEAD)’ returned non-zero exit status 1.
INFO: A newer version of bench is available: 5.15.1 b’\xe2’b’\x86’b’\x92’ 5.16.0

Running On Ubuntu 22.04 fully updated


Is this the first time an update has been attempted or were prior updates successful?

What was the cli command that failed and with what result?

What does: bench version return?

Sorry for the late reply:

bench_manager 0.0.1
drive 0.0.1
erpnext 14.9.0
frappe 14.17.1
hrms 1.0.0
lms 0.0.1
map_defaults 0.0.1
payments 0.0.1
pibicut 0.0.1

this is the first time im trying to update.

Try updating frappe-bench: sudo pip3 install frappe-bench --upgrade

Then navigate to your frappe folder/apps and in each of the app folders try git status and git pull to see if one of the apps is causing the issue. If they all complete without error try bench update --reset.

1 Like

You legend! So it was an issue when i followed:

As the setup specific a specific version, not a branch, that was causing the issues.

Completely forgot about git status so thankyou very much for reminding me!