How to fix: Next.js build fails: Type 'string' is not assignable to type after Lovable/Bolt export
This Supabase/Next.js failure usually means raw form, URL, or JSON data crossed into a narrower TypeScript type without parsing. Add a small boundary parser, use the narrowed value in server actions or routes, then rerun the original build command.
This pattern is common in AI-built Next.js and Supabase apps because generated code often leaves auth, cookie, deployment, or type boundaries unfinished. The exact symptom matters, so preserve the original error before changing code.
Why it happens
The app is passing raw form or route data into a narrower TypeScript/domain type without a parsing boundary.
What to check
Find where `FormData`, URL params, or JSON body fields enter the server action or route.
Check the domain union type and confirm every external string is parsed before insert/update.
Run the build locally before and after the smallest parser fix.
Add one smoke path for the exact action that failed the build.
Fix plan
Add a small parser that narrows external strings into the domain union with a safe default or explicit error.
Use the parsed value in the insert/update payload, not the raw form value.
Keep dependency versions stable unless the version is the direct cause.
Capture before/after build logs and the action smoke output.
When to stop guessing
If this touches auth, RLS, database writes, storage, redirects, or deployment callbacks, a build-only fix is not enough. Verify the real user path against the same Supabase project and domain that failed.
Need a second set of eyes? Paste the exact error into the free diagnosis form and get a focused rescue plan before you spend more time guessing.