az interactive cli gets stuck on the same error, after an error with the 'keys()' query function
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
### Describe the bug
When an error occurs where the [`keys`](https://jmespath.org/proposals/functions.html#keys) function was used within the `--query` string, the cli becomes unusable, throwing the same error, no matter the command.

### Related command
`az resource list --query [0].NonExistingProperty`
`az resource list --query [0].keys(NonExistingProperty)`
Error occurs here
`az resource list --query [0].NonExistingProperty`
Same error occurs, even though this command worked before
`az resource list`
Same error occurs, even though a `--query` flag is not even provided
### Errors
Invalid jmespath query supplied for `--query`: In function keys(), invalid type for value: None, expected one of: ['object'], received: "null"
### Issue script & Debug output

### Expected behavior
The cli should be able to execute the third and fourth command without problem, not throwing the same error over and over.
### Environment Summary
```
azure-cli 2.49.0 *
core 2.49.0 *
telemetry 1.0.8 *
Extensions:
interactive 0.5.1
Dependencies:
msal 1.20.0
azure-mgmt-resource 22.0.0
Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\e.steerneman\.azure\cliextensions'
Python (Windows) 3.10.10 (tags/v3.10.10:aad5f6a, Feb 7 2023, 17:05:00) [MSC v.1929 32 bit (Intel)]
Legal docs and information: aka.ms/AzureCliLegal
You have 3 update(s) available. Consider updating your CLI installation with 'az upgrade'
```
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.