# \[SOLVED\] Rancher-agent 401 error

**URL:** <https://forums.suse.com/t/solved-rancher-agent-401-error/1841>\
**Category:** Rancher 1.x\
**Created:** [February 23, 2016, 9:43pm UTC](https://forums.suse.com/t/solved-rancher-agent-401-error/1841 "2016-02-23T21:43:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ApolloDS](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/apollods/32/623_2.png) [@ApolloDS](https://forums.suse.com/u/ApolloDS)\
**Post date:** [February 23, 2016, 9:43pm UTC](https://forums.suse.com/t/solved-rancher-agent-401-error/1841/1 "2016-02-23T21:43:54Z")

</div>

Hi,  
Today I setup my ubuntu 14.04 server with docker.  
Everything works with docker and cli utilities, downloading images etc.

Now I try to add this host to rancher and I also was successful.

But when I add an application from the catalog I see that the rancher-agent is starting with a 401 client error.  
I see this in the rancher-agent logs:

```
2016-02-23 21:36:00,533 ERROR agent [140125455440144] [event.py:112] Error in request : 285dd989-1c13-45f7-96c7-60e11777a776
Traceback (most recent call last):
  File "/var/lib/cattle/pyagent/cattle/agent/event.py", line 95, in _worker_main
    resp = agent.execute(req)
  File "/var/lib/cattle/pyagent/cattle/agent/ __init__.py", line 15, in execute
    return self._router.route(req)
  File "/var/lib/cattle/pyagent/cattle/plugins/core/event_router.py", line 13, in route
    resp = handler.execute(req)
  File "/var/lib/cattle/pyagent/cattle/agent/handler.py", line 34, in execute
    return method(req=req, **req.data. __dict__ )
  File "/var/lib/cattle/pyagent/cattle/storage/ __init__.py", line 27, in image_activate
    action=lambda: self._do_image_activate(image, storage_pool,
  File "/var/lib/cattle/pyagent/cattle/agent/handler.py", line 72, in _do
    action()
  File "/var/lib/cattle/pyagent/cattle/storage/ __init__.py", line 28, in <lambda>
    progress)
  File "/var/lib/cattle/pyagent/cattle/plugins/docker/storage.py", line 149, in _do_image_activate
    insecure_registry=True):
  File "/var/lib/cattle/pyagent/dist/docker/api/image.py", line 200, in pull
    self._raise_for_status(response)
  File "/var/lib/cattle/pyagent/dist/docker/client.py", line 142, in _raise_for_status
    raise errors.APIError(e, response, explanation=explanation)
APIError: 401 Client Error: Unauthorized ("Authentication is required: Get https://registry-1.docker.io/v2/rancher/agent-instance/manifests/v0.8.0: unauthorized: incorrect username or password")

```

So what could be the problem here?  
I constantly see in the rancher ui those starting rancher-agents with the 401 client error.

---

<div class="post-metadata">

**Author:** ![denise](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@denise](https://forums.suse.com/u/denise)\
**Post date:** [March 10, 2016, 8:06pm UTC](https://forums.suse.com/t/solved-rancher-agent-401-error/1841/2 "2016-03-10T20:06:27Z")

</div>

You are using the same host for the server and agent?

Have you made sure the IP of the host in the Rancher server (UI) is the correct IP?

[http://docs.rancher.com/rancher/rancher-ui/infrastructure/hosts/custom/#adding-hosts-to-the-same-machine-as-rancher-server](http://docs.rancher.com/rancher/rancher-ui/infrastructure/hosts/custom/#adding-hosts-to-the-same-machine-as-rancher-server)

---

<div class="post-metadata">

**Author:** ![ApolloDS](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/apollods/32/623_2.png) [@ApolloDS](https://forums.suse.com/u/ApolloDS)\
**Post date:** [March 11, 2016, 6:23am UTC](https://forums.suse.com/t/solved-rancher-agent-401-error/1841/3 "2016-03-11T06:23:10Z")

</div>

Hi denise,  
I solved the problem when I recreated the Environment again.  
I don’t know what was wrong with the env, but now it is working properly again.

What I did once was to change the rancher hostname from hostname to FQDN in the settings.

Thanks for the hint denise.  
👍

---

<div class="post-metadata">

**Author:** ![denise](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@denise](https://forums.suse.com/u/denise)\
**Post date:** [March 11, 2016, 3:00pm UTC](https://forums.suse.com/t/solved-rancher-agent-401-error/1841/4 "2016-03-11T15:00:43Z")

</div>


