BUG: IndexError occuring on duplicate axis does not fail gracefully.
- [x] I have checked that this issue has not already been reported.

- [x] I have confirmed this bug exists on the latest version of pandas.

- [ ] (optional) I have confirmed this bug exists on the master branch of pandas.

---

**Note**: Please read [this guide](https://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports) detailing how to provide the necessary information for us to reproduce your bug.

#### Code Sample, a copy-pastable example

```python
# Your code here
import pandas as pd
import numpy as np
# pd.show_versions()


## Adjust N for your machine
# n = 10000000
df = pd.DataFrame(np.arange(n), columns='a'.split()).assign(**{'ts':pd.date_range(start='2020-01-01', freq='1S', periods=n)})

df['td'] = df.ts.dt.normalize()


df = df.set_index(['td', 'ts'])


# Missing index level from reset
d = df.reset_index(1).groupby(pd.Grouper(level=0)).a.apply(lambda x: (x.shift() - x ) < pd.Timedelta(minutes=1))
d
# The assignment, usage of values solves index error
df['x'] = d.cumsum()#.values
df
```

#### Problem description

Assigning in my case causes very slow climbing in memory and if the dataframe is large enough, OOM killing.
The dataframe is similar is width to the example here, the equivalent multi-index is unique.

Raising this stops using hunting for memory leaks or bugs etc.

#### Expected Output

The error is raised quickly without requiring disproportionate memory.

#### Output of ``pd.show_versions()``

```
pandas           : 1.2.1
numpy            : 1.19.5
```

</details>
