[GH-ISSUE #7289] [Bug] SQLite SQL-length refusals omit the SQL-statement allowance from their diagnostic #4324

Closed
opened 2026-10-31 00:48:55 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @coygeek on GitHub (Oct 26, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/7289

Before submitting

  • I searched the open and closed issues for a related report.
  • I removed credentials, tokens, private paths, and sensitive target data.

Area

Evidence, artifacts, or reconstruction

Observed behavior

Source review confirms that a native SQLite SQL-statement-length refusal reaches a resource diagnostic that names only the value/record and worker JSON reply allowances. Separately supplied public CLI output shows the expected symptom for a table with one 4,200,000-character ASCII column name: row sampling exits 1 with resource_constraint, resource: transport, string or blob too big, and only sqlite_value_or_record_bytes and worker_reply_bytes in reported_limits. This reviewer did not execute the reproduction.

Reproduction

The supplied recipe creates a closed local database with one ordinary table, one INTEGER column and one row. The following reproduces that recipe using neutral filenames; it was inspected, not executed by this reviewer. Use a supported Node runtime with DatabaseSync.limits and the prepared REA CLI on the source baseline below.

node --input-type=module <<'JS'
import { DatabaseSync } from 'node:sqlite';
for (const [file, size] of [['long-identifier.db', 4_200_000], ['control-identifier.db', 4_100_000]]) {
  const name = 'c' + 'x'.repeat(size - 1);
  const db = new DatabaseSync(file);
  db.exec(`CREATE TABLE t("${name}" INTEGER); INSERT INTO t VALUES (1);`);
  db.close();
}
JS
rea inspect-sqlite-database long-identifier.db --table t --json
rea inspect-sqlite-database long-identifier.db --schema-scope database --json
rea inspect-sqlite-database control-identifier.db --table t --json

Use a fresh directory so neither database already exists. The supplied CLI log records one invocation of each inspection: the first exits 1; the other two exit 0. Frequency outside that supplied sequence is unknown. The source proof below establishes the attribution defect independently of executing this recipe again.

Expected behavior

The diagnostic should include the SQL-statement allowance among the constraints that can produce this refusal. If it identifies a particular exhausted allowance, that attribution should match the failure. The SQLite guide distinguishes value/record, SQL-statement and complete worker reply limits, each 16 MiB, and promises a meaningful reason for resource failures. Refusing this row query is consistent with the fixed SQL-statement limit; no increased limit or successful row response is requested.

Impact and scope

P3 diagnostic and recovery-wording defect. The affected statement contains repeated copies of an unusually long selected identifier. The native refusal remains correct, its reason survives, and no incorrect successful rows or data loss are established. Reducing row_limit cannot shorten the SQL text because the limit is bound as a parameter. Selecting fewer columns cannot help this single-column fixture. The supplied schema-only call succeeds, but it does not recover the requested row. Real-world incidence, MCP execution and other platforms were not tested by this reviewer.

REA version

Source revision 0d1a454e25db825567782e461da21530bad4b158; source HEAD confirmed locally.

Runtime and platform

Node.js 24.22.1; macOS 27.0.1 arm64, supplied by the contributor who ran the CLI. NOT_ENOUGH_INFO: the supplied summary log does not record the SQLite engine version. No runtime or platform probe was executed in this review.

Target and artifact context

Synthetic offline SQLite file with ordinary table t, one ASCII column identifier, one INTEGER value 1, and no application functions, generated expressions or external providers. The supplied long-identifier file is 4,210,688 bytes, below the 256 MiB snapshot allowance; its schema is readable in the supplied CLI sequence. Schema readability does not constitute a full integrity check.

Interface

CLI

Earliest failure stage

Transport or result projection

Relevant output or evidence

The contributor-supplied public CLI summary contains these results; this reviewer read the captured output without replaying it:

{"label":"row sample, 4.2M-character column identifier","exitCode":1,"code":"resource_constraint","resource":"transport","message":"string or blob too big","reported_limits":{"sqlite_value_or_record_bytes":16777216,"worker_reply_bytes":16777216},"outputBytes":921}
{"label":"database schema scope, same file","exitCode":0,"code":null,"resource":null,"message":null,"reported_limits":null,"outputBytes":8404716}
{"label":"row sample, 4.1M-character control","exitCode":0,"code":null,"resource":null,"message":null,"reported_limits":null,"outputBytes":12304864}
  • Expected source: docs/sqlite-databases.md:129-134 separates the three byte allowances; lines 192-195 require a meaningful resource-failure reason.
  • Failure source: src/sqlite/SqliteDatabaseInspection.ts:737-761 generates the row SQL, lines 798-800 configure the native limits, and rowEvaluationFailure at lines 629-632 preserves native errors other than primary code 1; src/sqlite/SqliteDatabaseWorker.ts:53-62 maps primary code 18 to output-limit; src/sqlite/SqliteDatabaseWorkerExecution.ts:151-167 reports only value/record and reply allowances and omits SQL length.
  • Evidence provenance: static for the independently reviewed diagnostic mapping and generated-statement length; supplied for the public CLI results quoted above.
  • Local verification: static-proof; runtime reproduction was not run. The registered CLI passes path and table through the shared service and provider to the native worker. This ordinary one-column input passes selection and schema guards; the 4,210,688-byte file fits input admission and the supplied schema control confirms that acquisition/schema reading succeeded. The length query is 3*n + 137 ASCII bytes and the projection is 4*n + 146, calculated from the source templates using only a one-character placeholder and arithmetic. At n = 4,200,000, these are 12,600,137 and 16,800,146 bytes respectively; the latter exceeds 16,777,216 before row evaluation or complete reply serialization. Native SQL-length refusal therefore reaches the shared mapping described above.
  • Reproduction completeness: complete.

The current mapper's remediation starts with The SQLite value/record and worker JSON reply allowances are fixed at 16 MiB and proposes exact column selection, a lower row limit or inventory. That text is source-derived, not quoted from a full error document in the supplied summary. A successful full reply for the failing selection was never captured; no exact hypothetical reply-size claim is made.

Typed outcome or recovery expected

Preserve the resource refusal and native reason while including the fixed SQL-statement limit in its explanation and reported allowances. Guidance should not imply that a lower row count shortens this generated statement. Schema-only inspection remains a narrower available observation, not recovery of the refused row result.

Analysis or suspected cause

The source uses the same native primary code for multiple length-related refusals. It groups code 18 into output-limit, then describes that group using only two of the three independently configured/documented boundaries. For this fixture, the generated lengths query fits while the value-projection SQL does not. This supports incomplete diagnostic attribution; it does not establish that the error explicitly asserts both named allowances were exceeded, nor require a separate public error category for every native cause.

Additional context

The supplied open/closed snapshot contains related reports: #6292 and merged PR #6327 concern result-column count, handled through primary code 1; #6855 concerns metadata bind variables; #6888 and PR #6899 concern internal schema-name budget accounting; #5456 concerns advice to retrieve nonexistent Evidence; #6607 concerns missing selected-path context; #5812 concerns deadline and recovery controls. Their stated triggers and restoration checks differ from SQL-length attribution. No exact duplicate was found in that supplied snapshot; no network freshness check was performed. NOT_ENOUGH_INFO: no known-good prior revision or actual MCP result was supplied.

Restoration check

With the long-identifier fixture unchanged, the row call may still refuse, but its diagnostic must include the SQL-statement allowance and accurately scope its recovery advice. Keep the shorter-identifier row control successful and the schema-only control readable. Preserve correct value/record and complete-reply refusals; changing the intended limit, dropping requested columns or returning partial success would not establish restoration. These are proposed checks, not tests executed during this review.

Triage assessment

  • Impact level: P3
  • Assessment status: supported
  • Impact basis: The supported defect changes the explanation and guidance for an intended resource refusal on an unusual synthetic identifier; the evidence establishes no incorrect successful result, corruption or additional denial of supported rows beyond the documented limit.
  • Workaround status: available
  • Workaround basis: The documented separate SQL-statement allowance supplies the missing diagnostic context. The supplied schema-only call succeeds when schema facts suffice; this does not recover the refused row or bypass the fixed allowance.

References

Delivery checks against current main confirmed source revision 0d1a454e25db825567782e461da21530bad4b158, unchanged from the independently reviewed baseline. Fresh open and closed issue/PR searches and related-thread reads found no exact duplicate. This freshness check inspected source and GitHub records; it did not replay the runtime recipe.

  • Documented independent byte allowances and meaningful resource-failure reasons.
  • Generated row statements, native limits, code-18 mapping, and two-allowance diagnostic.
  • Closed #6292 and merged #6327 concern result-column capacity under primary code 1; this report concerns SQL-statement length under primary code 18.
  • Closed #6855 concerns inventory metadata bind-variable capacity; this fixture has one selected column and reaches row SQL preparation.
  • Closed #6888 and superseded #6899 concern internal schema-name accounting that refused results which should fit; this report preserves the intended SQL-length refusal.
  • Closed #5456 corrected advice to retrieve nonexistent Evidence. Current source contains that correction, while its explanation still omits the SQL-statement allowance.
  • Closed #6607 concerns selected-file identity in resource errors. Current source includes that identity; SQL-length diagnostic coverage remains distinct.
  • Closed #5812 and merged #5818 concern worker deadlines and recovery controls; the current fixed-limit diagnostic still lists only two byte allowances.
Originally created by @coygeek on GitHub (Oct 26, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/7289 ## Before submitting - [x] I searched the open and closed issues for a related report. - [x] I removed credentials, tokens, private paths, and sensitive target data. ## Area Evidence, artifacts, or reconstruction ## Observed behavior Source review confirms that a native SQLite SQL-statement-length refusal reaches a resource diagnostic that names only the value/record and worker JSON reply allowances. Separately supplied public CLI output shows the expected symptom for a table with one 4,200,000-character ASCII column name: row sampling exits 1 with `resource_constraint`, `resource: transport`, `string or blob too big`, and only `sqlite_value_or_record_bytes` and `worker_reply_bytes` in `reported_limits`. This reviewer did not execute the reproduction. ## Reproduction The supplied recipe creates a closed local database with one ordinary table, one INTEGER column and one row. The following reproduces that recipe using neutral filenames; it was inspected, not executed by this reviewer. Use a supported Node runtime with `DatabaseSync.limits` and the prepared REA CLI on the source baseline below. ```sh node --input-type=module <<'JS' import { DatabaseSync } from 'node:sqlite'; for (const [file, size] of [['long-identifier.db', 4_200_000], ['control-identifier.db', 4_100_000]]) { const name = 'c' + 'x'.repeat(size - 1); const db = new DatabaseSync(file); db.exec(`CREATE TABLE t("${name}" INTEGER); INSERT INTO t VALUES (1);`); db.close(); } JS rea inspect-sqlite-database long-identifier.db --table t --json rea inspect-sqlite-database long-identifier.db --schema-scope database --json rea inspect-sqlite-database control-identifier.db --table t --json ``` Use a fresh directory so neither database already exists. The supplied CLI log records one invocation of each inspection: the first exits 1; the other two exit 0. Frequency outside that supplied sequence is unknown. The source proof below establishes the attribution defect independently of executing this recipe again. ## Expected behavior The diagnostic should include the SQL-statement allowance among the constraints that can produce this refusal. If it identifies a particular exhausted allowance, that attribution should match the failure. The SQLite guide distinguishes value/record, SQL-statement and complete worker reply limits, each 16 MiB, and promises a meaningful reason for resource failures. Refusing this row query is consistent with the fixed SQL-statement limit; no increased limit or successful row response is requested. ## Impact and scope P3 diagnostic and recovery-wording defect. The affected statement contains repeated copies of an unusually long selected identifier. The native refusal remains correct, its reason survives, and no incorrect successful rows or data loss are established. Reducing `row_limit` cannot shorten the SQL text because the limit is bound as a parameter. Selecting fewer columns cannot help this single-column fixture. The supplied schema-only call succeeds, but it does not recover the requested row. Real-world incidence, MCP execution and other platforms were not tested by this reviewer. ## REA version Source revision `0d1a454e25db825567782e461da21530bad4b158`; source HEAD confirmed locally. ## Runtime and platform Node.js 24.22.1; macOS 27.0.1 arm64, supplied by the contributor who ran the CLI. NOT_ENOUGH_INFO: the supplied summary log does not record the SQLite engine version. No runtime or platform probe was executed in this review. ## Target and artifact context Synthetic offline SQLite file with ordinary table `t`, one ASCII column identifier, one INTEGER value `1`, and no application functions, generated expressions or external providers. The supplied long-identifier file is 4,210,688 bytes, below the 256 MiB snapshot allowance; its schema is readable in the supplied CLI sequence. Schema readability does not constitute a full integrity check. ## Interface CLI ## Earliest failure stage Transport or result projection ## Relevant output or evidence The contributor-supplied public CLI summary contains these results; this reviewer read the captured output without replaying it: ```json {"label":"row sample, 4.2M-character column identifier","exitCode":1,"code":"resource_constraint","resource":"transport","message":"string or blob too big","reported_limits":{"sqlite_value_or_record_bytes":16777216,"worker_reply_bytes":16777216},"outputBytes":921} {"label":"database schema scope, same file","exitCode":0,"code":null,"resource":null,"message":null,"reported_limits":null,"outputBytes":8404716} {"label":"row sample, 4.1M-character control","exitCode":0,"code":null,"resource":null,"message":null,"reported_limits":null,"outputBytes":12304864} ``` - Expected source: `docs/sqlite-databases.md:129-134` separates the three byte allowances; lines 192-195 require a meaningful resource-failure reason. - Failure source: `src/sqlite/SqliteDatabaseInspection.ts:737-761` generates the row SQL, lines 798-800 configure the native limits, and `rowEvaluationFailure` at lines 629-632 preserves native errors other than primary code 1; `src/sqlite/SqliteDatabaseWorker.ts:53-62` maps primary code 18 to `output-limit`; `src/sqlite/SqliteDatabaseWorkerExecution.ts:151-167` reports only value/record and reply allowances and omits SQL length. - Evidence provenance: static for the independently reviewed diagnostic mapping and generated-statement length; supplied for the public CLI results quoted above. - Local verification: static-proof; runtime reproduction was not run. The registered CLI passes `path` and `table` through the shared service and provider to the native worker. This ordinary one-column input passes selection and schema guards; the 4,210,688-byte file fits input admission and the supplied schema control confirms that acquisition/schema reading succeeded. The length query is `3*n + 137` ASCII bytes and the projection is `4*n + 146`, calculated from the source templates using only a one-character placeholder and arithmetic. At `n = 4,200,000`, these are 12,600,137 and 16,800,146 bytes respectively; the latter exceeds 16,777,216 before row evaluation or complete reply serialization. Native SQL-length refusal therefore reaches the shared mapping described above. - Reproduction completeness: complete. The current mapper's remediation starts with `The SQLite value/record and worker JSON reply allowances are fixed at 16 MiB` and proposes exact column selection, a lower row limit or inventory. That text is source-derived, not quoted from a full error document in the supplied summary. A successful full reply for the failing selection was never captured; no exact hypothetical reply-size claim is made. ## Typed outcome or recovery expected Preserve the resource refusal and native reason while including the fixed SQL-statement limit in its explanation and reported allowances. Guidance should not imply that a lower row count shortens this generated statement. Schema-only inspection remains a narrower available observation, not recovery of the refused row result. ## Analysis or suspected cause The source uses the same native primary code for multiple length-related refusals. It groups code 18 into `output-limit`, then describes that group using only two of the three independently configured/documented boundaries. For this fixture, the generated lengths query fits while the value-projection SQL does not. This supports incomplete diagnostic attribution; it does not establish that the error explicitly asserts both named allowances were exceeded, nor require a separate public error category for every native cause. ## Additional context The supplied open/closed snapshot contains related reports: #6292 and merged PR #6327 concern result-column count, handled through primary code 1; #6855 concerns metadata bind variables; #6888 and PR #6899 concern internal schema-name budget accounting; #5456 concerns advice to retrieve nonexistent Evidence; #6607 concerns missing selected-path context; #5812 concerns deadline and recovery controls. Their stated triggers and restoration checks differ from SQL-length attribution. No exact duplicate was found in that supplied snapshot; no network freshness check was performed. NOT_ENOUGH_INFO: no known-good prior revision or actual MCP result was supplied. ## Restoration check With the long-identifier fixture unchanged, the row call may still refuse, but its diagnostic must include the SQL-statement allowance and accurately scope its recovery advice. Keep the shorter-identifier row control successful and the schema-only control readable. Preserve correct value/record and complete-reply refusals; changing the intended limit, dropping requested columns or returning partial success would not establish restoration. These are proposed checks, not tests executed during this review. ## Triage assessment - Impact level: P3 - Assessment status: supported - Impact basis: The supported defect changes the explanation and guidance for an intended resource refusal on an unusual synthetic identifier; the evidence establishes no incorrect successful result, corruption or additional denial of supported rows beyond the documented limit. - Workaround status: available - Workaround basis: The documented separate SQL-statement allowance supplies the missing diagnostic context. The supplied schema-only call succeeds when schema facts suffice; this does not recover the refused row or bypass the fixed allowance. ## References Delivery checks against current `main` confirmed source revision `0d1a454e25db825567782e461da21530bad4b158`, unchanged from the independently reviewed baseline. Fresh open and closed issue/PR searches and related-thread reads found no exact duplicate. This freshness check inspected source and GitHub records; it did not replay the runtime recipe. - [Documented independent byte allowances](https://github.com/morluto/rea/blob/0d1a454e25db825567782e461da21530bad4b158/docs/sqlite-databases.md#L129-L134) and [meaningful resource-failure reasons](https://github.com/morluto/rea/blob/0d1a454e25db825567782e461da21530bad4b158/docs/sqlite-databases.md#L192-L195). - [Generated row statements](https://github.com/morluto/rea/blob/0d1a454e25db825567782e461da21530bad4b158/src/sqlite/SqliteDatabaseInspection.ts#L737-L761), [native limits](https://github.com/morluto/rea/blob/0d1a454e25db825567782e461da21530bad4b158/src/sqlite/SqliteDatabaseInspection.ts#L786-L820), [code-18 mapping](https://github.com/morluto/rea/blob/0d1a454e25db825567782e461da21530bad4b158/src/sqlite/SqliteDatabaseWorker.ts#L53-L62), and [two-allowance diagnostic](https://github.com/morluto/rea/blob/0d1a454e25db825567782e461da21530bad4b158/src/sqlite/SqliteDatabaseWorkerExecution.ts#L151-L167). - Closed [#6292](https://github.com/morluto/rea/issues/6292) and merged [#6327](https://github.com/morluto/rea/pull/6327) concern result-column capacity under primary code 1; this report concerns SQL-statement length under primary code 18. - Closed [#6855](https://github.com/morluto/rea/issues/6855) concerns inventory metadata bind-variable capacity; this fixture has one selected column and reaches row SQL preparation. - Closed [#6888](https://github.com/morluto/rea/issues/6888) and superseded [#6899](https://github.com/morluto/rea/pull/6899) concern internal schema-name accounting that refused results which should fit; this report preserves the intended SQL-length refusal. - Closed [#5456](https://github.com/morluto/rea/issues/5456) corrected advice to retrieve nonexistent Evidence. Current source contains that correction, while its explanation still omits the SQL-statement allowance. - Closed [#6607](https://github.com/morluto/rea/issues/6607) concerns selected-file identity in resource errors. Current source includes that identity; SQL-length diagnostic coverage remains distinct. - Closed [#5812](https://github.com/morluto/rea/issues/5812) and merged [#5818](https://github.com/morluto/rea/pull/5818) concern worker deadlines and recovery controls; the current fixed-limit diagnostic still lists only two byte allowances.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#4324
No description provided.