Error while using redirect in shopify remix scaffold

hey guys I am trying to redirect to this specific page if a subscription doesn’t exist but I keep getting the following error why is that -

the code I am using before the redirect is -

export const loader = async ({ request }: LoaderFunctionArgs) => {
const { session } = await authenticate.admin(request);

const billingData = await checkSubscription(session);

if (!billingData.hasPaidPlan) {
return redirect(“/app/plans”);
}

return null;
};

code in the plans page
export const loader = async ({ request }: LoaderFunctionArgs) => {
console.log(“Loading plans page”);

const { session } = await authenticate.admin(request);
const billingData = await getBillingData(session);

console.log(“Billing data:”, billingData);

const redirected = request.headers.get(“X-Subscription-Required”) === “true”;

return json({
billingData,
redirected,
});
};

could someone help me understand why this is happening thanks!