Repository: scikit-hep/uproot5

Issue:
Error in untested AwkwardForth case
### Discussed in https://github.com/scikit-hep/uproot5/discussions/826

<div type='discussions-op-text'>

<sup>Originally posted by **renyhp** February 16, 2023</sup>
Hi, I have just installed uproot, but I can't get it to read a tree.

My code is very simple:

```python3
import uproot
f = uproot.reading.open("myfile.root")
t = f.get("aTree")
t['TheOnlyBranch'].array()
```

This just crashes with this stacktrace:
```text
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/venv/lib/python3.10/site-packages/uproot/behaviors/TBranch.py", line 834, in arrays
    _ranges_or_baskets_to_arrays(
  File "/tmp/venv/lib/python3.10/site-packages/uproot/behaviors/TBranch.py", line 3124, in _ranges_or_baskets_to_arrays
    uproot.source.futures.delayed_raise(*obj)
  File "/tmp/venv/lib/python3.10/site-packages/uproot/source/futures.py", line 36, in delayed_raise
    raise exception_value.with_traceback(traceback)
  File "/tmp/venv/lib/python3.10/site-packages/uproot/behaviors/TBranch.py", line 3066, in basket_to_array
    basket_arrays[basket.basket_num] = interpretation.basket_array(
  File "/tmp/venv/lib/python3.10/site-packages/uproot/interpretation/objects.py", line 139, in basket_array
    output = self.basket_array_forth(
  File "/tmp/venv/lib/python3.10/site-packages/uproot/interpretation/objects.py", line 206, in basket_array_forth
    output = self._discover_forth(
  File "/tmp/venv/lib/python3.10/site-packages/uproot/interpretation/objects.py", line 286, in _discover_forth
    output[i] = self._model.read(
  File "/tmp/venv/lib/python3.10/site-packages/uproot/containers.py", line 609, in read
    return uproot.deserialization.read_object_any(
  File "/tmp/venv/lib/python3.10/site-packages/uproot/deserialization.py", line 274, in read_object_any
    obj = cls.read(chunk, cursor, context, file, selffile, parent)
  File "/tmp/venv/lib/python3.10/site-packages/uproot/model.py", line 1372, in read
    versioned_cls.read(
  File "/tmp/venv/lib/python3.10/site-packages/uproot/model.py", line 867, in read
    self.read_members(chunk, cursor, context, file)
  File "<dynamic>", line 567, in read_members
KeyError: dtype('int8')
```

The branch does contain subbranches, some of them are of type `int8` and `uint8`.

Am I doing anything wrong or is this a bug to be reported?</div>


Discussion:

Resolving patch:
diff --git a/src/uproot/behaviors/TBranch.py b/src/uproot/behaviors/TBranch.py
--- a/src/uproot/behaviors/TBranch.py
+++ b/src/uproot/behaviors/TBranch.py
@@ -3007,8 +3007,10 @@ def _ranges_or_baskets_to_arrays(
             )
 
         # check for CannotBeAwkward errors on the main thread before reading any data
-        if isinstance(library, uproot.interpretation.library.Awkward) and isinstance(
-            interpretation, uproot.interpretation.objects.AsObjects
+        if (
+            isinstance(library, uproot.interpretation.library.Awkward)
+            and isinstance(interpretation, uproot.interpretation.objects.AsObjects)
+            and cache_key in branchid_to_branch
         ):
             branchid_to_branch[cache_key]._awkward_check(interpretation)
 


Test patch: