can1357/oh-my-pi · error · ToolError
SQLite row lookups cannot be combined with query parameters
Error message
SQLite row lookups cannot be combined with query parameters
What it means
Thrown when a row lookup selector (table:key form with a non-empty key) is combined with query parameters. Row lookup is an exact-key fetch and accepts no where/limit/order params, so their presence is rejected as ambiguous.
Source
Thrown at packages/coding-agent/src/tools/sqlite-reader.ts:593
}
if (!normalizedSubPath) {
if (params.size > 0) {
throw new ToolError("SQLite query parameters require a table selector or q=SELECT...");
}
return { kind: "list" };
}
const separatorIndex = normalizedSubPath.indexOf(":");
const table = separatorIndex === -1 ? normalizedSubPath : normalizedSubPath.slice(0, separatorIndex);
const key = separatorIndex === -1 ? undefined : normalizedSubPath.slice(separatorIndex + 1);
if (!table) {
throw new ToolError("SQLite selectors must include a table name");
}
if (key !== undefined && key.length > 0) {
if (params.size > 0) {
throw new ToolError("SQLite row lookups cannot be combined with query parameters");
}
return { kind: "row", table, key };
}
const where = validateWhereClause(params.get("where") ?? undefined);
const order = params.get("order")?.trim() || undefined;
const hasQueryParams = params.has("limit") || params.has("offset") || order !== undefined || where !== undefined;
if (hasQueryParams) {
const knownKeys = new Set(["limit", "offset", "order", "where"]);
for (const keyName of params.keys()) {
if (!knownKeys.has(keyName)) {
throw new ToolError(`Unsupported SQLite query parameter '${keyName}'`);
}
}
return {
kind: "query",
table,
limit: parseLimit(params.get("limit"), DEFAULT_QUERY_LIMIT),View on GitHub (pinned to 9690622007)
Solutions
- Remove all query params when doing a keyed row lookup
- If you need filtering/pagination, use the table selector without a key instead
- Fetch the row by key and filter client-side if needed
Example fix
// before db.sqlite/users:42?where=active=1 // after db.sqlite/users:42
Defensive patterns
Strategy: validation
Validate before calling
if (key != null && key.length > 0 && Object.keys(params).length > 0) {
throw new Error('row lookups (table:key) take no query params');
} Try / catch
try {
await reader.read(`db.sqlite/${table}:${key}`);
} catch (err) {
if (err instanceof ToolError && err.message.includes('row lookups cannot be combined')) {
// strip params or switch to the table-query form without :key
} else throw err;
} Prevention
- Use separate helpers for row-fetch (no params) and table-query (params allowed)
- Strip accumulated params when switching from list mode to keyed lookup
- Encode the key safely but never attach where/limit/order to keyed URLs
When it happens
Trigger: 'db.sqlite/users:42?limit=1'; adding where/order to a keyed lookup; generic URL builders that always append params.
Common situations: Reusing a param-appending helper for both list and row-fetch URLs; leftover params after switching from a table query to a keyed lookup.
Related errors
- SQLite raw queries cannot be combined with table selectors o
- SQLite query parameters require a table selector or q=SELECT
- vault://${op} requires '${name}' query parameter
- SQLite query parameter 'q' cannot be empty
- SQLite selectors must include a table name
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/2bc19fd34d12ad2b.
Report an issue: GitHub.