Skip to content

Failed to start DataStore - DataStoreException: "Row too big to fit into CursorWindow" #5885

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 of 14 tasks
NoahRazzaq opened this issue Jan 30, 2025 · 3 comments
Open
3 of 14 tasks
Assignees
Labels
datastore Issues related to the DataStore Category question A question about the Amplify Flutter libraries to-be-reproduced Issues that have not been reproduced yet, but have reproduction steps provided

Comments

@NoahRazzaq
Copy link

NoahRazzaq commented Jan 30, 2025

Description

I encountered an issue with AWS Amplify DataStore in Flutter where querying models results in the following error when launching the app for the second time in debug mode. However, I do not experience this issue in the production environment.

DataStoreException { "message": "Failed to start DataStore.", "recoverySuggestion": "Retry.", "underlyingException": "DataStoreException{message=Timed out while starting to observe storage changes., cause=java.lang.RuntimeException: DataStoreException{message=Error in querying the model., cause=android.database.sqlite.SQLiteBlobTooBigException: Row too big to fit into CursorWindow requiredPos=0, totalRows=1, recoverySuggestion=See attached exception for details.}, recoverySuggestion=There is a possibility that there is a bug if this error persists.

exception: Row too big to fit into CursorWindow requiredPos=0, totalRows=1; query: SELECT PersistentRecord.id AS PersistentRecord_id, PersistentRecord containedModelClassName AS PersistentRecord_containedModelClassName, PersistentRecord.containedModelId AS PersistentRecord_containedModelId, PersistentRecord.serializedMutationData AS PersistentRecord_serializedMutationData FROM PersistentRecord LIMIT ? OFFSET ?;"

The error suggests that a row is too big to fit into SQLite's CursorWindow.

Could you provide guidance on how to handle this issue?

Categories

  • Analytics
  • API (REST)
  • API (GraphQL)
  • Auth
  • Authenticator
  • DataStore
  • Notifications (Push)
  • Storage

Steps to Reproduce

  1. Create a DataStore model with large string or JSON fields.
  2. Save multiple large records to DataStore.
  3. Start the the app in debug mode and the stop/kill the app
  4. Restart the app in debug mode (2nd launch).
  5. Observe that DataStore fails to start with the error.

Screenshots

No response

Platforms

  • iOS
  • Android
  • Web
  • macOS
  • Windows
  • Linux

Flutter Version

3.22.1

Amplify Flutter Version

2.4.1

Deployment Method

Amplify Gen 2

Schema

@github-actions github-actions bot added pending-triage This issue is in the backlog of issues to triage pending-maintainer-response Pending response from a maintainer of this repository labels Jan 30, 2025
@ekjotmultani ekjotmultani added the datastore Issues related to the DataStore Category label Jan 30, 2025
@ekjotmultani
Copy link
Member

ekjotmultani commented Jan 30, 2025

Hi @NoahRazzaq, I'm sorry to see that you are facing this issue, thank you for taking the time to open it! I want to clarify, when you say launching for the second time, do you mean by completely terminating the app or through flutter itself (i.e. re-running it in vscode). Also, are you using simulators or physical devices, and do you notice this issue on both ios and android? Could you provide a sample schema as well?

@github-actions github-actions bot removed the pending-maintainer-response Pending response from a maintainer of this repository label Jan 30, 2025
@ekjotmultani ekjotmultani added the to-be-reproduced Issues that have not been reproduced yet, but have reproduction steps provided label Jan 30, 2025
@ekjotmultani ekjotmultani self-assigned this Jan 30, 2025
@tyllark tyllark added pending-community-response Pending response from the issue opener or other community members question A question about the Amplify Flutter libraries and removed pending-triage This issue is in the backlog of issues to triage labels Feb 6, 2025
@NoahRazzaq
Copy link
Author

NoahRazzaq commented Feb 18, 2025

Hi @ekjotmultani
Sorry for not getting back to you sooner,I was quite busy.

To clarify, when I mentioned launching for the second time, I meant completely terminating the app and then starting debugging again (e.g., stopping the app and then clicking "Start Debugging" in VS Code).

I'm using an Android tablet.

Reproduction Model
The following is not my actual class but a reproduction of the issue.

import 'package:amplify_core/amplify_core.dart' as amplify_core;

class MyData extends amplify_core.Model {
  final int id;
  final String name;
  final double price;
  final bool isActive;
  final DateTime createdAt;
  final int quantity;
  final String category;
  final double rating;
  final bool inStock;
  final String description;
  final List<String> tags;
  final String metadata; // Large JSON stored as String
  final String brand;
  final int views;
  final String color;
  final double weight;
  final int stockCount;
  final String size;
  final bool isFeatured;
  final String sku;
  final String barcode;
  final double discount;
  final int sold;
  final String manufacturer;
  final double length;
  final double width;
  final double height;
  final String modelNumber;
  final bool isReturnable;
  final String warranty;
  final double tax;
  final int minOrderQuantity;
  final int maxOrderQuantity;
  final bool isExclusive;
  final String countryOfOrigin;
  final double shippingCost;
  final String seller;
}

The metadata field stores large JSON data, and I suspect that this is what’s causing the SQLiteBlobTooBigException when DataStore tries to process it.

Additional Info
I have recorded around 200 MyData entries in DataStore.
I provided a JSON file for you to try, which contains a sample of the metadata field.

large_metadata.json

Let me know if you need more details!

Thanks for your help!

@github-actions github-actions bot added pending-maintainer-response Pending response from a maintainer of this repository and removed pending-community-response Pending response from the issue opener or other community members labels Feb 18, 2025
@tyllark tyllark assigned tyllark and unassigned ekjotmultani Feb 20, 2025
@ekjotmultani
Copy link
Member

Thanks for the additional info @NoahRazzaq, it will help us investigate

@github-actions github-actions bot removed the pending-maintainer-response Pending response from a maintainer of this repository label Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datastore Issues related to the DataStore Category question A question about the Amplify Flutter libraries to-be-reproduced Issues that have not been reproduced yet, but have reproduction steps provided
Projects
None yet
Development

No branches or pull requests

3 participants