Seaquel
PostgreSQL error code

PostgreSQL error 22033

22033 is the SQLSTATE PostgreSQL reports for invalid sql json subscript, in class 22, Data Exception.

SQLSTATE22033
Condition nameinvalid_sql_json_subscript
Class22 — Data Exception

Reproduce it, then fix it

In strict mode an index past the end of the array raises an error; lax mode, the default, returns nothing. Use last to get the final element whatever the length. Run the broken query to see the error, then switch to the fixed one. Edit either freely; every run is rolled back.

SELECT jsonb_path_query('{"tags": ["sale"]}', 'strict $.tags[1]');
SELECT jsonb_path_query('{"tags": ["sale"]}', 'strict $.tags[last]');

Source: PostgreSQL documentation, Appendix A