tursodatabase/turso · error · Error
Unknown column type: ${kind}
Error message
Unknown column type: ${kind} What it means
Statement.readColumnValue() switches on the native rowValueKind(index) over TursoType NULL, INTEGER, REAL, TEXT, and BLOB; the default arm throws for any other value. NULL is explicitly handled (returns null), so this is not a null-value problem — it means the native side returned a kind integer the JS enum does not know, typically UNKNOWN (0) or a value from a newer native build.
Source
Thrown at bindings/react-native/src/Statement.ts:377
switch (kind) {
case TursoType.NULL:
return null;
case TursoType.INTEGER:
return this._statement.rowValueInt(index);
case TursoType.REAL:
return this._statement.rowValueDouble(index);
case TursoType.TEXT:
// Use rowValueText which directly returns a string from C++ (avoids encoding issues)
return this._statement.rowValueText(index);
case TursoType.BLOB:
return this._statement.rowValueBytesPtr(index) || new ArrayBuffer(0);
default:
throw new Error(`Unknown column type: ${kind}`);
}
}
/**
* Reset statement for re-execution
*
* @returns this for chaining
*/
reset(): this {
if (this._finalized) {
throw new Error('Statement has been finalized');
}
this._statement.reset();
return this;
}
/**View on GitHub (pinned to bad083fafb)
Solutions
- Rebuild native (pod install / clean gradle) and ensure the npm package version matches the native module revision
- Clear Metro and native build caches after upgrading
- Log the kind value in a catch to confirm which code the native side returned
- If versions are aligned and a valid row still produces it, report it as a binding bug with the query and value
Example fix
// before
const rows = await stmt.all(); // reading a row throws: Unknown column type: 7
// after (diagnostic wrapper to capture the offending kind)
try {
const rows = await stmt.all();
} catch (e) {
console.error('kind reported by native:', /type: (\d+)/.exec(e.message)?.[1]);
throw e;
}
// then: cd ios && pod install && npx react-native start --reset-cache Defensive patterns
Strategy: try-catch
Type guard
function isUnknownColumnTypeError(e: unknown): boolean {
return e instanceof Error && /Unknown column type: \d+/.test(e.message);
} Try / catch
try {
const rows = await stmt.all();
} catch (e) {
if (isUnknownColumnTypeError(e)) {
const kind = Number(/type: (\d+)/.exec(e.message)[1]);
// kind from a newer native build → rebuild/align versions; do not swallow
throw new Error(`JS/native type enum out of sync (native kind ${kind}) — rebuild native module`);
}
throw e;
} Prevention
- Treat any 'Unknown column type' as a version-skew smell: rebuild native immediately
- Keep npm package, pods, and gradle artifacts locked to the same release
- Clear Metro and native caches when switching branches/tags of the SDK
When it happens
Trigger: JS TursoType enum (types.ts) out of sync with the native rowValueKind implementation — e.g. the native module was rebuilt from newer source that emits a new type code while the JS package is older; rowValueKind returning 0/UNKNOWN because the row cursor is not positioned on a valid row.
Common situations: Partial upgrades: bumping the npm package but not running pod install, or vice versa; monorepos where multiple app shells build the native module from different checkouts; nightly/native canary builds.
Related errors
- Failed to get column name at index ${i}
- Turso native module not loaded
- @tursodatabase/sync-react-native: Failed to install JSI bind
- @tursodatabase/sync-react-native: JSI bindings not found on
- Unknown result type: ${resultKind}
AI-assisted analysis of tursodatabase/turso@bad083fafb (2026-08-16).
Data as JSON: /api/errors/5e032465daa83153.
Report an issue: GitHub.