Remix loader/action did not return a Response in CI
A Remix loader or action must return data (via json) or a Response (via redirect, defer, or a raw Response). Returning undefined throws at request time, and type-checking in CI catches many of these before they ship.
What this error means
The app throws "You defined a loader/action for route X but did not return anything", or remix build/tsc fails on a loader whose return type is not assignable.
Error: You defined a loader for route "routes/dashboard" but didn't return
anything from your `loader` function. Please return a value or `null`.Common causes
A code path with no return
A branch in the loader/action (an early guard, a caught error) falls through without returning json, redirect, or null.
An async function that never resolves data
The loader awaits work but forgets to return the result, so the function resolves to undefined.
How to fix it
Return json, redirect, or null on every path
- Ensure each branch returns
json(...), aredirect(...), or explicitnull. - Type the loader with
LoaderFunctionArgsso CI type-checks the return. - Re-run the build to confirm the return type is satisfied.
export async function loader({ request }: LoaderFunctionArgs) {
const user = await getUser(request);
if (!user) return redirect("/login");
return json({ user });
}Type-check in CI to catch it early
Add a tsc --noEmit step so a loader missing a return fails the build instead of the running app.
npx tsc --noEmitHow to prevent it
- Always return
json,redirect,defer, ornullfrom loaders/actions. - Use the typed
LoaderFunctionArgs/ActionFunctionArgssignatures. - Run
tsc --noEmitin CI to catch missing returns.