---
url: /mobx-view-model/v9/errors/1.md
---
# &#x20;Error `#1`: Active `ViewModel` not found

This happened because `vmLookup` for the [`useViewModel`](/react/api/use-view-model) hook is not provided, and the hook tries to look up the active view model using `ActiveViewModelContext`, which exists only when using the [`withViewModel`](/react/api/with-view-model) HOC.

## Explanation:

This usage of hook [`useViewModel`](/react/api/use-view-model)

```tsx
const model = useViewModel<YourVM>();
```

Will use `ActiveViewModelContext` which exist only with usage [`withViewModel`](/react/api/with-view-model) HOC.

This can also happen if you are trying to access an active `ViewModel` that does not exist in the current React render tree:

```tsx
<Component1>
  <ComponentAChild1>
    <Component>
      useViewModel<YourVM>()
    </Component>
  </ComponentAChild1>
  <YourVMComponent /> - this provide active `ViewModel` (withViewModel)
</Component1>
```

## Potential solution

The potential solution to this problem is to pass the [`vmLookup`](/api/other/view-model-lookup) to the [`useViewModel`](/react/api/use-view-model) hook:

```tsx
const model = useViewModel(YourVM);
const model = useViewModel("idofyourvm");
```

Or use `useViewModel<YourVM>()` with the correct active `ViewModel` in the React render tree:

```tsx
<YourVMComponent> - this provide active `ViewModel` (withViewModel)
  <Component1>
    <ComponentAChild1>
      <Component>
        useViewModel<YourVM>()
      </Component>
    </ComponentAChild1>
  </Component1>
</YourVMComponent>
```
