Data not saving in your app
Data that vanishes on refresh was either never sent to the database, refused by an access rule, or saved somewhere other than where the screen reads from.

Key takeaways
- The most common cause with a Supabase backend is row-level security with no policy that allows the insert or update. The database refuses quietly.
- The second is an app that only ever saved to the browser (state or local storage), never to a database.
- Always look at the actual save request in the Network tab and the error it returns. Most apps hide that error from the screen.
If you click Save, see no error, and the data is gone after a refresh, the most likely cause is that the database refused the write and the app did not tell you. With Supabase-based backends, that usually means row-level security is on for the table and no policy allows this user to insert or update the row. The second most likely cause is that the app never saved to a database at all: it kept the data in the browser, so it vanishes on refresh or on another device.
First, watch the save happen
Open the developer tools, pick the Network tab, and click Save. You are looking for a request to your backend (the URL contains your table name or `/rest/v1/`). What you find decides which section below applies:
- No request at all: the app saves only in the browser, or the save code never runs. Causes 2 and 5.
- 401 or 403, or a message mentioning "row-level security policy": an access rule refused it. Cause 1.
- 400 with a message about a column, type or constraint: the data does not fit the table. Cause 3.
- 201 or 200 but the data still disappears: it saved, but somewhere the screen does not read from, or it was overwritten. Cause 4.
- Request fails or times out: the backend is unreachable or paused. Cause 6.
The causes, most likely first
1. Row-level security with no matching policy
Row-level security (RLS) is the right default: once it is on, all rows are hidden and all writes refused until a policy allows them. The trap is having a SELECT policy (so reading works) but no INSERT or UPDATE policy, or an INSERT policy whose WITH CHECK condition fails. A common example: the policy requires `user_id = auth.uid()`, but the app never sets `user_id` on the new row, so it is null and the check fails.
How to check: the error in the response mentions "violates row-level security policy". In Startbase Cloud, the Data section has an RLS policies view listing every policy per table with its command (ALL, SELECT, INSERT, UPDATE, DELETE). Check there is one for the command your save uses. Note that updates that match no rows often return success with zero rows changed, rather than an error. The fix: add a policy for the missing command, and make sure the app sets ownership columns (or give the column a default of `auth.uid()`). Do not turn RLS off to make saving work; that opens the table to everyone. Row-level security explained walks through the patterns.
2. The data only ever lived in the browser
A prototype often keeps data in component state or `localStorage`. It looks saved: it survives switching screens, and local storage even survives a refresh, on that one browser. On a phone or after clearing the browser, it is gone. How to check: no backend request when you click Save, and the code mentions `useState` or `localStorage` for this data. The fix: move the data into a database table. If the project has no backend yet, Startbase Cloud adds one (the agent asks in chat when a request needs a database; click Enable). Then ask the agent to migrate the feature to read and write the table.
3. The data does not fit the table
The table expects a number and the form sends `"12"` as text with a comma, a required column is missing, a date is in the wrong format, or a unique constraint blocks a duplicate. How to check: the response is a 400 with the raw Postgres error, which names the column. The fix: fix the form to send the right type, or change the column. Schema changes should go through the agent so they land as migrations in your code rather than ad hoc edits.
4. Saved, but not where the screen reads
The save worked (you can see the row in the table browser) but the screen still shows old data. Typical reasons: the list was cached and never refreshed after the save, the save wrote to a different table or a different project, or a second save immediately overwrote the first with stale values (two tabs, or a form that saves its initial values on load). How to check: open the table in the Data section and look for the row. The fix: refresh or update the cached list after every successful save, and make sure every screen reads from the same source.
5. The error is caught and ignored
Code like `const { data } = await supabase.from('notes').insert(note)` ignores the `error` field that comes back. The app shows "Saved!" because nothing threw. This is not a separate root cause so much as the reason causes 1 and 3 are invisible. The fix: check `error` on every write, show a clear message when it is set ("Couldn't save your note. Try again."), and keep the user's input on screen so they do not lose it.
6. The backend is off or paused
If saving stopped working everywhere at once, check the backend. Disabling Cloud for a project stops data, sign-in and uploads until it is enabled again, and on Hosted by Startbase, hosted databases pause if the Cloud Credits balance runs out. The Overview section shows whether the backend is running, paused or waking. Nothing is lost in either case.
7. Auto-save that never fires
Apps that save on blur or after a typing pause can lose the last edit if the user closes the tab first. The fix: save on a short debounce (about one second after typing stops is a common starting value), and warn before leaving the page while a save is pending.
Use the backend logs
The Logs section of the Backend tab searches runtime events across the API, Postgres and other services. Pick the API or Postgres source, set the time range to the last 15 minutes, and reproduce the failed save. Every expanded log row has a Fix with AI button that sends it to the agent with its details. Log retention on the free database tier is short (about a day), so check soon after the problem happens.
The message to send the agent
Saving a new task shows "Saved!" but the task is gone after refresh. In the Network tab the POST to /rest/v1/tasks returns 403 with "new row violates row-level security policy for table tasks". Reading tasks works. Please: check the RLS policies on tasks and add an INSERT and UPDATE policy so signed-in users can create and edit only their own tasks, give user_id a default of the current user, make every save in the app check the returned error and show a friendly message without clearing the form, and refresh the task list after a successful save. Do not disable RLS.
New to databases? Database basics for non-developers and the database docs explain tables, the table browser and policies.
Frequently asked questions
Why does my Supabase insert return no error but save nothing?
Usually the error is returned in the response and the code ignores it, or an update matched zero rows because a policy hid them. Log the error field and check the table's RLS policies.
Should I turn off row-level security so saving works?
No. That lets anyone with your app's public key read and change every row. Add the specific policy the save needs instead.
Why does my data save on my computer but not appear on my phone?
The app saves to the browser (local storage), not a database. Each device has its own copy. Move the data into a database table.

