diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/en/common.json b/airflow-core/src/airflow/ui/public/i18n/locales/en/common.json index 211244bd68480..8aee7cb16deec 100644 --- a/airflow-core/src/airflow/ui/public/i18n/locales/en/common.json +++ b/airflow-core/src/airflow/ui/public/i18n/locales/en/common.json @@ -89,6 +89,7 @@ "back": "Back", "defaultMessage": "An unexpected error occurred", "home": "Home", + "invalidUrl": "Page Not Found. Please check the URL and try again.", "notFound": "Page Not Found", "title": "Error" }, diff --git a/airflow-core/src/airflow/ui/src/pages/Error.tsx b/airflow-core/src/airflow/ui/src/pages/Error.tsx index 7b9ee1b8a3950..28fa9ec84af98 100644 --- a/airflow-core/src/airflow/ui/src/pages/Error.tsx +++ b/airflow-core/src/airflow/ui/src/pages/Error.tsx @@ -30,7 +30,10 @@ export const ErrorPage = () => { let errorMessage = translate("error.defaultMessage"); let statusCode = ""; - if (isRouteErrorResponse(error)) { + if (error === null || error === undefined) { + statusCode = "404"; + errorMessage = translate("error.invalidUrl"); + } else if (isRouteErrorResponse(error)) { statusCode = String(error.status); errorMessage = ((error as unknown as Error).message || (error as { statusText?: string }).statusText) ?? diff --git a/airflow-core/src/airflow/ui/src/router.tsx b/airflow-core/src/airflow/ui/src/router.tsx index 052096eaa1d5f..5c3ddc76174e2 100644 --- a/airflow-core/src/airflow/ui/src/router.tsx +++ b/airflow-core/src/airflow/ui/src/router.tsx @@ -227,6 +227,10 @@ export const routerConfig = [ element: , path: "dags/:dagId/tasks/:taskId", }, + { + element: , + path: "*", + }, ], element: , errorElement: (