{"record":{"id":"e1bc9d57de3d3042","repo":"tursodatabase/turso","slug":"unsupported-parameter-type-typeof-value","errorCode":null,"errorMessage":"Unsupported parameter type: ${typeof value}","messagePattern":"Unsupported parameter type: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"bindings/react-native/src/Statement.ts","lineNumber":118,"sourceCode":"   * @param value - Value to bind\n   */\n  private bindValue(position: number, value: SQLiteValue): void {\n    if (value === null || value === undefined) {\n      this._statement.bindPositionalNull(position);\n    } else if (typeof value === 'number') {\n      // Check if integer or float\n      if (Number.isInteger(value)) {\n        this._statement.bindPositionalInt(position, value);\n      } else {\n        this._statement.bindPositionalDouble(position, value);\n      }\n    } else if (typeof value === 'string') {\n      this._statement.bindPositionalText(position, value);\n    } else if (value instanceof ArrayBuffer || ArrayBuffer.isView(value)) {\n      const buffer = value as unknown as ArrayBuffer;\n      this._statement.bindPositionalBlob(position, buffer);\n    } else {\n      throw new Error(`Unsupported parameter type: ${typeof value}`);\n    }\n  }\n\n  /**\n   * Execute statement without returning rows (for INSERT, UPDATE, DELETE)\n   *\n   * @param params - Optional parameters to bind\n   * @returns Result with changes and lastInsertRowid\n   */\n  async run(...params: BindParams[]): Promise<RunResult> {\n    if (this._finalized) {\n      throw new Error('Statement has been finalized');\n    }\n\n    if (this._execLock) {\n      await this._execLock.acquire();\n    }\n    try {","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/tursodatabase/turso/blob/bad083fafbefdeae9a42ec19bdaaad8918dcf411/bindings/react-native/src/Statement.ts#L100-L136","documentation":"bindValue() accepts exactly five kinds of input: null/undefined (bound as NULL), number (int or double depending on Number.isInteger), string, and ArrayBuffer or any ArrayBuffer view (bound as BLOB). Everything else — boolean, bigint, plain objects, Date, functions — reaches the final else branch and throws 'Unsupported parameter type' with the JS typeof. The SQLite C API has no boolean or arbitrary-object storage class, so the binding refuses rather than guessing a coercion.","triggerScenarios":"`stmt.bind(true)` or `stmt.bind({ a: 1 })`; passing a Date object directly; passing a BigInt (typeof 'bigint') from a counter or ID generator; arrays nested inside a flattened parameter list; undefined nested inside an object value's sub-field after JSON parsing.","commonSituations":"Binding JSON API payloads or form state that contain booleans; migrating from a binding that auto-coerced booleans to 0/1; using crypto or snowflake IDs that produce BigInt; passing ISO dates as Date objects instead of strings.","solutions":["Convert before binding: booleans to 0/1, Date to ISO string or epoch number, BigInt to number (or string), objects to JSON.stringify(...)","Sanitize unknown payloads through a normalize(value) function that maps every unsupported type to a supported one or throws your own descriptive error","Type your bind values as SQLiteValue (null | number | string | ArrayBuffer) so TypeScript flags bad call sites at compile time"],"exampleFix":"// before\nawait stmt.run({ active: true, createdAt: new Date(), id: 9007199254740993n }); // throws\n\n// after\nawait stmt.run({\n  active: 1, // boolean -> integer\n  createdAt: new Date().toISOString(), // Date -> string\n  id: '9007199254740993', // BigInt -> string to keep precision\n});","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"type BindableValue = null | number | string | ArrayBuffer | ArrayBufferView;\n\nfunction isBindableValue(v: unknown): v is BindableValue {\n  return (\n    v === null ||\n    typeof v === 'number' ||\n    typeof v === 'string' ||\n    v instanceof ArrayBuffer ||\n    ArrayBuffer.isView(v)\n  ); // note: undefined also binds as NULL per bindValue()\n}\n\nfunction toBindable(v: unknown): BindableValue {\n  if (isBindableValue(v) || v === undefined) return v as BindableValue;\n  if (typeof v === 'boolean') return v ? 1 : 0;\n  if (typeof v === 'bigint') return v.toString();\n  if (v instanceof Date) return v.toISOString();\n  return JSON.stringify(v);\n}\n\nstmt.bind(toBindable(value));","tryCatchPattern":null,"preventionTips":["Normalize unknown payloads through a toBindable() converter before binding","Type bind values as SQLiteValue so unsupported types fail at compile time","Remember booleans, bigint, Date, and plain objects are never auto-coerced"],"tags":["react-native","statement","bind","type-error","sqlite"],"backgroundTag":"unsupported-bind-type","analyzedSha":"bad083fafbefdeae9a42ec19bdaaad8918dcf411","analyzedAt":"2026-08-16T23:12:11.798Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}