addons icon indicating copy to clipboard operation
addons copied to clipboard

Git Pull: "Unexpected server response. Status code: 401"

Open LucasHokerberg opened this issue 1 year ago • 7 comments

Describe the issue you are experiencing

Same as #3587.

When running Git Pull (the plug-in), it pulls the latest code, but fails on configuration check:

[Info] Checking if something has changed...
[Info] Something has changed, checking Home-Assistant config...
Unexpected server response. Status code: 401
time="2024-08-02T17:10:58Z" level=error msg="Unexpected server response. Status code: 401"
[Error] Configuration updated but it does not pass the config check. Do not restart until this is fixed!

What type of installation are you running?

Home Assistant OS

Which operating system are you running on?

Home Assistant Operating System

Which add-on are you reporting an issue with?

Git pull

What is the version of the add-on?

7.14.1

Steps to reproduce the issue

Push some new code to the GIT repo and have the add-on to pull the changes.

System Health information

System Information

version core-2024.7.4
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.4
os_name Linux
os_version 6.6.33-haos
arch x86_64
timezone Europe/Stockholm
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 5000
Installed Version 1.34.0
Stage running
Available Repositories 1385
Downloaded Repositories 14
Home Assistant Cloud
logged_in true
subscription_expiration August 14, 2024 at 02:00
relayer_connected true
relayer_region eu-central-1
remote_enabled false
remote_connected false
alexa_enabled false
google_enabled true
remote_server eu-central-1-8.ui.nabu.casa
certificate_status ready
instance_id 10dbf997ff5343c0a8d95920b74ec575
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 12.4
update_channel stable
supervisor_version supervisor-2024.06.2
agent_version 1.6.0
docker_version 26.1.4
disk_total 53.4 GB
disk_used 20.9 GB
healthy true
supported true
host_connectivity true
supervisor_connectivity true
ntp_synchronized true
virtualization kvm
board ova
supervisor_api ok
version_api ok
installed_addons Grafana (10.0.0), InfluxDB (5.0.0), MariaDB (2.7.1), Git pull (7.14.1), Samba share (12.3.2), Traccar (0.25.0), Mosquitto broker (6.4.1), Terminal & SSH (9.14.0), File editor (5.8.0)
Dashboards
dashboards 3
resources 5
views 26
mode storage
Recorder
oldest_recorder_run July 23, 2024 at 18:19
current_recorder_run August 1, 2024 at 14:36
estimated_db_size 2728.89 MiB
database_engine mysql
database_version 10.11.6
Spotify
api_endpoint_reachable ok

Anything in the Supervisor logs that might be useful for us?

Logger: homeassistant.components.hassio
Source: components/hassio/websocket_api.py:135
integration: Home Assistant Supervisor (documentation, issues)
First occurred: 19:11:06 (3 occurrences)
Last logged: 19:14:32

Failed to to call /addons/core_git_pull/stats - Container addon_core_git_pull is not running

Anything in the add-on logs that might be useful for us?

See descrpition.

Additional information

No response

LucasHokerberg avatar Aug 02 '24 17:08 LucasHokerberg

Getting the same error for quite a while now. My current workaround is calling homassistant.reload_all ~5 seconds after starting the add-on (i start it via automation only after a successful CI run). Kinda annoying and obviously no automatic restarts

andarotajo avatar Aug 12 '24 20:08 andarotajo

Same here. Not sure since which version. The git pull itself is OK .. the request to do the config check gets a 401:

[Info] Staying on currently checked out branch: main...
[Info] Start git pull...
Updating ec68d18..506aa2a
Fast-forward
 entities/humidifiers/woonkamer.yaml | 23 -----------------------
 1 file changed, 23 deletions(-)
[Info] Checking if something has changed...
[Info] Something has changed, checking Home-Assistant config...
Unexpected server response. Status code: 401
time="2024-08-17T13:00:29Z" level=error msg="Unexpected server response. Status code: 401"
[Error] Configuration updated but it does not pass the config check. Do not restart until this is fixed!
s6-rc: info: service legacy-services: stopping

mpepping avatar Aug 17 '24 13:08 mpepping

I'm also seeing this, any solutions?

sam-cogan avatar Aug 30 '24 11:08 sam-cogan

same for me

HEAD is now at c2307d3 Update components
[Info] Checking if something has changed...
[Info] Something has changed, checking Home-Assistant config...
time="2024-09-09T08:52:11Z" level=error msg="Unexpected server response. Status code: 401"
Unexpected server response. Status code: 401

michaelkuty avatar Sep 09 '24 08:09 michaelkuty

Same for me: ha core check fails with 401.

[Info] Something has changed, checking Home-Assistant config...
time="2024-09-12T05:32:05Z" level=error msg="Unexpected server response. Status code: 401"
Unexpected server response. Status code: 401
[Error] Configuration updated but it does not pass the config check. Do not restart until this is fixed!```

sriramsv avatar Sep 12 '24 05:09 sriramsv

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Oct 12 '24 06:10 github-actions[bot]

Still an issue

[Info] Checking if something has changed...
[Info] Something has changed, checking Home-Assistant config...
Unexpected server response. Status code: 401
time="2024-10-12T06:20:37Z" level=error msg="Unexpected server response. Status code: 401"

mpepping avatar Oct 12 '24 06:10 mpepping

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Nov 11 '24 07:11 github-actions[bot]

this is still an issue

maartenhendrix avatar Nov 11 '24 21:11 maartenhendrix

This is also an issue for me.

fransixles avatar Nov 14 '24 01:11 fransixles

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Dec 14 '24 02:12 github-actions[bot]

Still an issue

[Info] Checking if something has changed... [Info] Something has changed, checking Home-Assistant config... time="2024-12-14T08:09:10Z" level=error msg="Unexpected server response. Status code: 401" Unexpected server response. Status code: 401

mpepping avatar Dec 14 '24 08:12 mpepping

The logging shows that the issue is in running the ha --no-progress core check command. That fails and breaks out of this if: https://github.com/home-assistant/addons/blob/master/git_pull/data/run.sh#L182

The ha command fails because of a missing SUPERVISOR_TOKEN env variable in the running Git add-on container, or at least for the shell running run.sh.

[core-ssh config]$ unset SUPERVISOR_TOKEN
[core-ssh config]$ ha --no-progress core check
ERRO[0000] Unexpected server response. Status code: 401
Unexpected server response. Status code: 401

Not sure on the direction on how to fix this. The Git add-on is the only container that I could find that runs the ha command from a shell script. The SSH add-on sets up a shell env. that contains a valid SUPERVISOR_TOKEN environment variable. Something similar must be added here.

mpepping avatar Dec 23 '24 20:12 mpepping

The SSH add-on sets up a shell env. that contains a valid SUPERVISOR_TOKEN environment variable. Something similar must be added here.

That just exposes the token to the new shell it makes. The thing I noticed about a lot of the scripts is the shebang is /usr/bin/with-contenv bashio but git-pull is just bash. I made a PR to update this and fix it. :)

raypappa avatar Dec 30 '24 03:12 raypappa

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jan 29 '25 04:01 github-actions[bot]

Still an issue. It might be fixed by https://github.com/home-assistant/addons/pull/3875.

apeeters avatar Jan 29 '25 07:01 apeeters

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Feb 28 '25 07:02 github-actions[bot]

This should indeed be fixed with #3714.

agners avatar Feb 28 '25 11:02 agners