{"record":{"id":"7931d6b20c8f4ac2","repo":"can1357/oh-my-pi","slug":"unsupported-sqlite-selector","errorCode":null,"errorMessage":"Unsupported SQLite selector","messagePattern":"Unsupported SQLite selector","errorType":"exception","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/read-sqlite.ts","lineNumber":206,"sourceCode":"\t\t\t\tconst result = executeReadQuery(db, selector.sql);\n\t\t\t\tlet output = renderTable(result.columns, result.rows, {\n\t\t\t\t\ttotalCount: result.rows.length,\n\t\t\t\t\toffset: 0,\n\t\t\t\t\tlimit: result.rows.length || DEFAULT_MAX_LINES,\n\t\t\t\t\ttable: \"query\",\n\t\t\t\t\tdbPath: resolvedSqlitePath.absolutePath,\n\t\t\t\t});\n\t\t\t\tif (result.truncated) {\n\t\t\t\t\toutput += `\\n[Output capped at ${MAX_RAW_QUERY_ROWS} rows; add a LIMIT/OFFSET clause to the query to page through more]`;\n\t\t\t\t}\n\t\t\t\treturn toolResult<ReadToolDetails>(details)\n\t\t\t\t\t.text(prependSuffixResolutionNotice(output, resolvedSqlitePath.suffixResolution))\n\t\t\t\t\t.sourcePath(resolvedSqlitePath.absolutePath)\n\t\t\t\t\t.done();\n\t\t\t}\n\t\t}\n\n\t\tthrow new ToolError(\"Unsupported SQLite selector\");\n\t} catch (error) {\n\t\tif (error instanceof ToolError) {\n\t\t\tthrow error;\n\t\t}\n\t\tthrow new ToolError(error instanceof Error ? error.message : String(error));\n\t} finally {\n\t\tdb?.close();\n\t}\n}\n","sourceCodeStart":188,"sourceCodeEnd":216,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/read-sqlite.ts#L188-L216","documentation":"readSqlite dispatches on a parsed SQLite selector (list/schema/row/query/raw). If the selector object carries none of the known variants, control falls past the switch and throws ToolError 'Unsupported SQLite selector'. It is an internal-exhaustiveness guard: user input should normally have been parsed into one of the supported shapes earlier.","triggerScenarios":"A selector parsed by the suffix parser that matches no case in the switch (e.g. a new/unknown selector variant reached readSqlite); programmatic callers constructing a malformed selector object; a selector type widened by a refactor without updating the switch.","commonSituations":"Plugin or SDK code passing a hand-built selector; version mismatch where a newer selector kind is fed to an older reader; typos in the path suffix that survive parsing into an unrecognized shape.","solutions":["Check the path suffix / selector construction — use a documented form (table list, :schema, :table?limit, raw query, conflict selector).","Inspect what selector value reached readSqlite (log or debugger) and map it to a supported variant.","Update the parser/switch if a new selector kind was added without a case.","Pin package versions so selector producers and consumers agree."],"exampleFix":"// before\ndbPath = 'file.db:unknown-selector';\n// after: use a supported suffix\ndbPath = 'file.db:mytable?limit=20'; // or 'file.db' for table list, 'file.db:mytable:schema'","handlingStrategy":"validation","validationCode":"const SUPPORTED = new Set(['list', 'schema', 'row', 'query', 'raw']);\nif (!SUPPORTED.has(selector.kind)) throw new Error(`Unsupported selector: ${selector.kind}`);\nreturn readSqlite(path, selector);","typeGuard":"function isSupportedSelector(s: unknown): s is { kind: 'list'|'schema'|'row'|'query'|'raw' } {\n  return typeof s === 'object' && s !== null &&\n    ['list','schema','row','query','raw'].includes((s as { kind?: string }).kind ?? '');\n}","tryCatchPattern":"try {\n  return await readSqlite(dbPath, selector);\n} catch (e) {\n  if (e instanceof ToolError && e.message === 'Unsupported SQLite selector') {\n    console.error('Selector kind not supported; use list/schema/row/query/raw');\n    return null;\n  }\n  throw e;\n}","preventionTips":["Only build selectors via the official parser/parse functions, never by hand.","Keep selector producer and reader versions in sync.","Validate the suffix against documented forms before constructing the read call.","Add a switch case + test whenever a new selector kind is introduced."],"tags":["sqlite","selector","validation"],"backgroundTag":"unsupported-selector","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}