Bench update ERROR: Command 'basename $(git symbolic-ref -q HEAD)' returned non-zero exit status 1

I’m geting error to update erpnext using bench cli

frappe@0ae0ae26c44b:~/frappe-bench$ bench update --reset
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 <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.10/site-packages/bench/cli.py", line 132, in cli
    bench_command()
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/bench/commands/update.py", line 59, in update
    update(
  File "/usr/local/lib/python3.10/site-packages/bench/utils/bench.py", line 428, in update
    validate_branch()
  File "/usr/local/lib/python3.10/site-packages/bench/utils/bench.py", line 615, in validate_branch
    branch = get_current_branch(app)
  File "/usr/local/lib/python3.10/site-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/site-packages/bench/utils/__init__.py", line 217, in get_cmd_output
    output = subprocess.check_output(
  File "/usr/local/lib/python3.10/subprocess.py", line 421, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/local/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'basename $(git symbolic-ref -q HEAD)' returned non-zero exit status 1.

Hi,

Is this happening on the first attempt to update frappe-bench or has it been updated successfully before?

What does: bench version return?

Here is versions

frappe@ba0e35314905:~/frappe-bench$ bench version
erpnext 14.34.3
frappe 14.44.0
hrms 14.10.0
india_compliance 14.15.1
payments 0.0.1
whitelabel 0.0.1

Try going into each of the folders in the apps/ and git pull or git status to see if one of the apps is causing the problem.

1 Like

actually after I update ERPNExt using bench update --reset my site can’t be accessed.
so I’ve wiped my system, and now using docker container for epnext. and I restored my old backups.
after I successfully restore old backup, there is many error stared coming up. mostly Invalid "depends_on" expression in Address Module, Item module, etc.
and the very big problem is I can’t see the Sales Invoice form. its completly hidden, strangly if I go to print preview, then I can see what ever content there.



I see this only for ERPNext and Frappe

frappe@ba0e35314905:~/frappe-bench/apps/erpnext$ git status
fatal: not a git repository (or any of the parent directories): .git

frappe@ba0e35314905:~/frappe-bench/apps/frappe$ git status
fatal: not a git repository (or any of the parent directories): .git

I’m not sure how git will behave in a Docker context, hopefully someOne with a better understanding will help.

Yeah, I check manually, there is is no file .git/HEAD on erpnext or frappe folder
I don’t know how it works.