chore: update org not found message to not collide w/ auth.js (#47192)

## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Error messages were failing due to a error code collision with Auth.js
in supabase + gotrue, fix that so the error is not suppressed

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Release Notes

* **Bug Fixes**
* Removed the "Organization not found" error message that appeared when
navigating to invalid organization slugs.
  * Streamlined redirect behavior for empty organization lists.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Ali Waseem authored and GitHub committed 2026-06-24 09:10:19 -06:00
1 parent 1bc9ac5940
commit 50989ac999
2 files changed
+2 -21

No files matched your search

@@ -68,7 +68,7 @@ export const RouteValidationWrapper = ({ children }: PropsWithChildren<{}>) => {
if (!isValidOrg) {
toast.error('You do not have access to this organization')
router.push(`${DEFAULT_HOME}?error=org_not_found&org=${slug}`)
router.push(DEFAULT_HOME)
return
}
}
+1 -20
View File
@@ -1,11 +1,9 @@
import { useParams } from 'common'
import { Plus, Search } from 'lucide-react'
import Head from 'next/head'
import Link from 'next/link'
import { useRouter } from 'next/router'
import { useEffect, useState } from 'react'
import { Button, Skeleton } from 'ui'
import { Admonition } from 'ui-patterns/admonition'
import { Input } from 'ui-patterns/DataInputs/Input'
import { NoOrganizationsState } from '@/components/interfaces/Home/ProjectList/EmptyStates'
@@ -27,8 +25,6 @@ const OrganizationsPage: NextPageWithLayout = () => {
const router = useRouter()
const { appTitle } = useCustomContent(['app:title'])
const [search, setSearch] = useState('')
const { error: orgNotFoundError, org: orgSlug } = useParams()
const orgNotFound = orgNotFoundError === 'org_not_found'
const pageTitle = buildStudioPageTitle({
section: 'Organizations',
brand: appTitle || 'Supabase',
@@ -52,8 +48,7 @@ const OrganizationsPage: NextPageWithLayout = () => {
useEffect(() => {
// If there are no organizations, force the user to create one
// unless the user is on the not found page
if (isSuccess && organizations.length <= 0 && !orgNotFound) {
if (isSuccess && organizations.length <= 0) {
router.push('/new')
}
}, [isSuccess, organizations])
@@ -66,20 +61,6 @@ const OrganizationsPage: NextPageWithLayout = () => {
</Head>
<ScaffoldContainer>
<ScaffoldSection isFullWidth className="flex flex-col gap-y-4">
{orgNotFound && (
<Admonition
type="destructive"
title="Organization not found"
description={
<>
The organization <code className="text-code-inline">{orgSlug}</code> does not
exist or you do not have permission to access to it. Contact the the owner if you
believe this is a mistake.
</>
}
/>
)}
{organizations.length > 0 && (
<div className="flex items-center justify-between gap-x-2 md:gap-x-3">
<Input