SQLite 3.54.1 Update Broke LLM Utility Logging: JSON Array Turned Into a String
The latest SQLite 3.54.1 from Homebrew broke logging in Simon Willison's LLM utility, a tool for working with language models. The query json_object('a', (select json_array(1))) used to return {"a":[1]}, but now it returns {"a":"[1]"}: the list became a quoted string. Richard Hipp, the author of SQLite, calls this a fix: according to the documentation, a subquery returns text, not JSON. If you nest subqueries inside json_object, wrap them in json().
AI-processed from Simon Willison; edited by Hamidun News
Sometimes an application breaks not because of your code or an update to the program itself, but because a library underneath it quietly changed. That is what happened with LLM, a command-line tool and Python library by Simon Willison for working with language models. It stores the history of model requests in a SQLite database. When Homebrew started shipping SQLite 3.54.1, logging stopped working: the json_object function began returning a nested JSON array as a plain string. LLM version 0.37.3 fixes this. The release is small, but it shows how a single database fix can break someone else's code that has worked for years.
What exactly broke
SQLite is the most widely deployed embedded database: it lives in browsers, phones, and thousands of utilities. It has JSON functions, including json_object (builds a JSON object) and json_array (builds a list). The LLM utility uses them when it writes information about each model call to the database.
The change is easy to see in one line. In SQLite 3.54.0, the query
select json_object('a', (select json_array(1)))
returned {"a":[1]}, meaning the nested list stayed a real list. In version 3.54.1, the same query returns {"a":"[1]"}. Quotation marks appeared, and for any code reading the result, this is a different data type: it expected a list and got text. For logs, this means the structure of the record no longer matches what was expected.
Bug or intended behavior
Richard Hipp, the author of SQLite, replied on the project forum directly: this was a bug fix. According to the documentation, the result of a (SELECT json_array(...)) construct is SQL text, not JSON. So the behavior in 3.54.1 is correct, and 3.54.0 was behaving incorrectly.
This situation is familiar to anyone who has worked with third-party APIs. You write code against behavior that is not in the specification. It works, you get used to it, and you stop noticing that you rely on an undocumented quirk. Later, the maintainers bring the implementation in line with the documentation, and your code breaks. Formally, they are right; in practice, the problem is yours.
How to fix your queries
The workaround is simple: if the nested subquery should remain JSON, tell the database explicitly by wrapping it in the json() function:
select json_object('a', json((select json_array(1))))
The json() function takes text, verifies that it is valid JSON, and returns it as a JSON value. Inside json_object, the list then stays a list and appears in the result without extra quotation marks.
What developers should do
First, check your own queries. Look for places where the result of a subquery using json_array or json_object is passed into an outer json_object or json_array. These are the constructs affected by the change. If you find them, add an explicit json() call.
Second, remember that SQLite often comes not from your lock file but from the system: through Homebrew, a Linux distribution, or a version bundled with a programming language. As a result, database behavior can change during a routine package update even though nothing in your project was touched. If reproducibility matters, pin the SQLite version in your environment or run tests against several versions.
Third, LLM users only need to upgrade to 0.37.3, and logging will work again with the new SQLite.
Limitations
The release itself is narrow. The fix addresses one quirk of the JSON functions and adds no new capabilities for working with models. The release notes contain no information about other changes in LLM, so those cannot be assessed. The lesson, however, is general: tests at the boundary with system libraries and explicit type casting save hours of debugging when a dependency is updated without your involvement.
- Jul 19, 2026Simon Willison's sqlite-utils 4.0 adds database schema migrations
- Oct 9, 2026Simon Willison releases ttok 0.4: the token counter gets --list-models
- Oct 24, 2026Narrow AI Agent vs. Universal Swiss Army Knife: How We Cut Response Latency from 17 to 7.7 Seconds
- Oct 29, 2026After a Claude Ban, a Developer Saved a Year of Chats: 146 MB Turned into a SQLite Database
Key Questions Answered
What exactly broke?
SQLite is the most widely deployed embedded database: it lives in browsers, phones, and thousands of utilities. It has JSON functions, including json_object (builds a JSON object) and json_array (builds a list). The LLM utility uses them when it writes information about each model call to the database. The change is easy to see in one line. In SQLite 3.54.0, the query select json_object('a', (select json_array(1))) returned {"a":[1]}, meaning the nested list stayed a real list.
What are the key details on Bug or intended behavior?
Richard Hipp, the author of SQLite, replied on the project forum directly: this was a bug fix. According to the documentation, the result of a (SELECT json_array(...)) construct is SQL text, not JSON. So the behavior in 3.54.1 is correct, and 3.54.0 was behaving incorrectly. This situation is familiar to anyone who has worked with third-party APIs. You write code against behavior that is not in the specification. It works, you get used to it, and you stop noticing that you rely on an undocumented quirk.
How to fix your queries?
The workaround is simple: if the nested subquery should remain JSON, tell the database explicitly by wrapping it in the json() function: select json_object('a', json((select json_array(1)))) The json() function takes text, verifies that it is valid JSON, and returns it as a JSON value. Inside json_object, the list then stays a list and appears in the result without extra quotation marks.
Test Frontier LLMs & Autonomous Agents in One Workspace
Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.
Daily 60-sec AI Voice Brief + Weekly Production AI Agent Playbook
Listen to a 60-second AI news brief every morning and get a weekly hands-on playbook for shipping AI agents to production — tools, MCP servers and patterns that work. Curated by Jemal Hamidun, Head of AI at Alpina Digital.
