# Failed to look up actor with name when actor is ALIVE in ray.state.actors()

**URL:** <https://discuss.ray.io/t/failed-to-look-up-actor-with-name-when-actor-is-alive-in-ray-state-actors/22391>\
**Category:** Ray Client\
**Created:** [April 27, 2025, 4:42pm UTC](https://discuss.ray.io/t/failed-to-look-up-actor-with-name-when-actor-is-alive-in-ray-state-actors/22391 "2025-04-27T16:42:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![btak](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/btak/32/7253_2.png) [@btak](https://discuss.ray.io/u/btak)\
**Post date:** [April 27, 2025, 4:42pm UTC](https://discuss.ray.io/t/failed-to-look-up-actor-with-name-when-actor-is-alive-in-ray-state-actors/22391/1 "2025-04-27T16:42:03Z")

</div>

Hi. In the main driver I create a named & detached actor called “main\_hub”.

```auto
MainHub_actor.options(name="main_hub", lifetime="detached").remote()

```

I’m using a library that spawns worker processes. This library does not use Ray.

When the worker process initializes, I call `ray.init(address="auto")`. The worker driver shows up in the Ray dashboard along side the main driver.

In the worker driver, I call `ray.get_actor("main_hub")`. And get the error:

```auto
Failed to look up actor with name 'main_hub'. This could because 1. You are trying to look up a named actor you didn't create. 2. The named actor died. 3. You did not use a namespace matching the namespace of the actor.

```

When I print the output of `ray.state.actors()`, I can see the main\_hub actor in an ALIVE state.

```auto
{'ActorID': '3f8de098c7069844d9ba374201000000', 'ActorClassName': 'MainHub_actor', 'IsDetached': True, 'Name': 'main_hub', 'JobID': '01000000', 'Address': {'IPAddress': '192.168.0.157', 'Port': 41243, 'NodeID': '5e360bece9cecf8649d0eb29025419877bc187970e1c34e9281061e4'}, 'OwnerAddress': {'IPAddress': '192.168.0.157', 'Port': 41453, 'NodeID': '5e360bece9cecf8649d0eb29025419877bc187970e1c34e9281061e4'}, 'State': 'ALIVE', 'NumRestarts': 0, 'Timestamp': 1745770994897.0, 'StartTime': 1745770994897, 'EndTime': 0, 'DeathCause': , 'Pid': 495823}

```

What could be happening & what should I do next?

---

<div class="post-metadata">

**Author:** ![btak](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/btak/32/7253_2.png) [@btak](https://discuss.ray.io/u/btak)\
**Post date:** [April 27, 2025, 4:49pm UTC](https://discuss.ray.io/t/failed-to-look-up-actor-with-name-when-actor-is-alive-in-ray-state-actors/22391/2 "2025-04-27T16:49:14Z")

</div>

The main\_hub actor is also present in the Livekit Dashboard. Different run so the ActorID is different.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/ray/original/2X/e/e1b42ca32a8355461398a792b71ecad29b979d34.jpeg)

---

<div class="post-metadata">

**Author:** ![btak](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/btak/32/7253_2.png) [@btak](https://discuss.ray.io/u/btak)\
**Post date:** [April 27, 2025, 5:12pm UTC](https://discuss.ray.io/t/failed-to-look-up-actor-with-name-when-actor-is-alive-in-ray-state-actors/22391/3 "2025-04-27T17:12:52Z")

</div>

If I call:

```auto
from ray._private.worker import global_worker

handle = global_worker.core_worker.get_actor_handle(
    ray.ActorID.from_hex(target_actor["ActorID"]) # noqa
)

```

I get:

```auto
[2025-04-27 13:06:16,003 C 775409 775409] actor_manager.cc:50: Check failed: it != actor_handles_.end() Cannot find an actor h
andle of id, 3f8de098c7069844d9ba374201000000. This method should be called only when you ensure actor handles exists.
***StackTrace Information***
/home/brian/work/project/.venv/lib/python3.12/site-packages/ray/_raylet.so(+0x13fd13a) [0x7393
dddfd13a] ray::operator<<()
/home/brian/work/project/.venv/lib/python3.12/site-packages/ray/_raylet.so(_ZN3ray6RayLogD1Ev+
0x479) [0x7393dddffbb9] ray::RayLog::~RayLog()
/home/brian/work/project/.venv/lib/python3.12/site-packages/ray/_raylet.so(_ZNK3ray4core12Acto
rManager14GetActorHandleERKNS_7ActorIDE+0x19c) [0x7393dd46f81c] ray::core::ActorManager::GetActorHandle()
/home/brian/work/project/.venv/lib/python3.12/site-packages/ray/_raylet.so(_ZNK3ray4core10Core
Worker14GetActorHandleERKNS_7ActorIDE+0x1d) [0x7393dd30c3dd] ray::core::CoreWorker::GetActorHandle()
/home/brian/work/project/.venv/lib/python3.12/site-packages/ray/_raylet.so(+0x835cd8) [0x7393d
d235cd8] __pyx_pw_3ray_7_raylet_10CoreWorker_105get_actor_handle()
/home/brian/.pyenv/versions/3.12.9/lib/libpython3.12.so.1.0(PyObject_Vectorcall+0x4f) [0x7393edf69fdf] PyObject_Vectorcall
/home/brian/.pyenv/versions/3.12.9/lib/libpython3.12.so.1.0(_PyEval_EvalFrameDefault+0x36af) [0x7393ee08e48f] _PyEval_EvalFrame
Default
/home/brian/.pyenv/versions/3.12.9/lib/libpython3.12.so.1.0(PyEval_EvalCode+0x217) [0x7393ee096247] PyEval_EvalCode
/home/brian/.pyenv/versions/3.12.9/lib/libpython3.12.so.1.0(+0x2f2f76) [0x7393ee0f2f76] run_eval_code_obj
/home/brian/.pyenv/versions/3.12.9/lib/libpython3.12.so.1.0(+0x2f3075) [0x7393ee0f3075] run_mod
/home/brian/.pyenv/versions/3.12.9/lib/libpython3.12.so.1.0(PyRun_StringFlags+0x6b) [0x7393ee0f669b] PyRun_StringFlags
/home/brian/.pyenv/versions/3.12.9/lib/libpython3.12.so.1.0(PyRun_SimpleStringFlags+0x3b) [0x7393ee0f670b] PyRun_SimpleStringFl
ags
/home/brian/.pyenv/versions/3.12.9/lib/libpython3.12.so.1.0(+0x31e572) [0x7393ee11e572] pymain_run_python.constprop.0
/home/brian/.pyenv/versions/3.12.9/lib/libpython3.12.so.1.0(Py_RunMain+0x26) [0x7393ee11f0a6] Py_RunMain
/home/brian/.pyenv/versions/3.12.9/lib/libpython3.12.so.1.0(Py_BytesMain+0x56) [0x7393ee11f256] Py_BytesMain
/usr/lib/libc.so.6(+0x27488) [0x7393edc35488]

```

Is there some sort of sync function I could call so the actor handles are seen?

Is there another way to access the ActorHandle?

---

<div class="post-metadata">

**Author:** ![btak](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/btak/32/7253_2.png) [@btak](https://discuss.ray.io/u/btak)\
**Post date:** [April 29, 2025, 1:26am UTC](https://discuss.ray.io/t/failed-to-look-up-actor-with-name-when-actor-is-alive-in-ray-state-actors/22391/4 "2025-04-29T01:26:06Z")

</div>

I didn’t set the namespace, which prints a message which I missed. Setting an explicit namespace worked!

```auto
2025-04-28 21:21:08,976 INFO worker.py:1843 -- Started a local Ray instance. View the dashboard at http://127.0.0.1:8265
(raylet) It looks like you're creating a detached actor in an anonymous namespace. In order to access this actor in the future, you will need to explicitly connect to this namespace with ray.init(namespace="15077777-87c3-489a-8a2a-32434c233edb", ...)

```
