From 88fcab126cb27986a01075de01cc2d3dd8280849 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 7 Nov 2025 19:31:13 +0000 Subject: [PATCH 1/2] fix(editor): fail fast when docs.yml cannot be loaded Previously, when getDocsYmlAndReferences() failed (e.g., due to SITE_NOT_FOUND), the editor layout would log the error but continue rendering with null data. This caused downstream components to throw errors that were caught by the error boundary and displayed as the generic 'This file contains markdown that is not yet readable by the editor' message. Now, the layout throws a digestible error immediately when getDocsYmlAndReferences() fails, which is caught by the [docsUrl]/error.tsx boundary and displays the appropriate error message (e.g., 'Your repository contains one or more Fern projects, but is missing a valid instance URL'). This makes the failure deterministic and provides users with clear, actionable error messages instead of confusing generic errors. Co-Authored-By: stephen@buildwithfern.com --- .../editor/[docsUrl]/[branch]/layout.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/fern-dashboard/src/app/[orgName]/(visual-editor)/editor/[docsUrl]/[branch]/layout.tsx b/packages/fern-dashboard/src/app/[orgName]/(visual-editor)/editor/[docsUrl]/[branch]/layout.tsx index 7c4e51070d..6f40237e79 100644 --- a/packages/fern-dashboard/src/app/[orgName]/(visual-editor)/editor/[docsUrl]/[branch]/layout.tsx +++ b/packages/fern-dashboard/src/app/[orgName]/(visual-editor)/editor/[docsUrl]/[branch]/layout.tsx @@ -68,14 +68,18 @@ export default async function EditorLayout({ branch, // fallback branch if default branch logic fails true // preferDefaultBranch = true ); - const latestDocsYmlAndReferences = docsYmlAndReferences.type === "ok" ? docsYmlAndReferences.result : null; - const fernFolderPath = - docsYmlAndReferences.type === "ok" ? docsYmlAndReferences.metadata.fernFolderPath : undefined; if (docsYmlAndReferences.type !== "ok") { console.error(docsYmlAndReferences.error); + throwDigestibleError( + new Error(`Failed to load docs configuration: ${docsYmlAndReferences.error.type}`), + docsYmlAndReferences.error.type + ); } + const latestDocsYmlAndReferences = docsYmlAndReferences.result; + const fernFolderPath = docsYmlAndReferences.metadata.fernFolderPath; + return ( From 260aa41d30a926d35801ec93f42c76327de0bce3 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 7 Nov 2025 19:48:04 +0000 Subject: [PATCH 2/2] fix(editor): add missing DOCS_YML_MISSING error message Add DOCS_YML_MISSING to ERROR_DIGEST_KEYS and ERROR_DIGEST_MESSAGES to prevent users from seeing 'Unknown error occurred' when docs.yml is missing from their repository. Addresses Vercel Agent Review feedback. Co-Authored-By: stephen@buildwithfern.com --- packages/fern-dashboard/src/utils/errors.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/fern-dashboard/src/utils/errors.ts b/packages/fern-dashboard/src/utils/errors.ts index 565badef10..83c59c0bf2 100644 --- a/packages/fern-dashboard/src/utils/errors.ts +++ b/packages/fern-dashboard/src/utils/errors.ts @@ -13,6 +13,7 @@ export type ERROR_DIGEST_KEYS = | "BASE_BRANCH_NOT_SET" | "USER_NOT_IN_ORG" | "WRITE_PERMISSION_ERROR" + | "DOCS_YML_MISSING" | GithubValidationErrorKeys; export const ERROR_DIGEST_MESSAGES: Record = { @@ -20,6 +21,8 @@ export const ERROR_DIGEST_MESSAGES: Record = { "We were unable to find your working branch. Please confirm that the GitHub branch exists and has not been deleted.", BASE_BRANCH_NOT_SET: "Looks like your source repo is not configured correctly. Please set a base branch on your GitHub repo.", + DOCS_YML_MISSING: + "The docs.yml configuration file was not found in your repository. Please ensure a valid docs.yml file exists in your Fern project.", REPO_NOT_CONNECTED: "Please connect your GitHub repo above.", REPO_NOT_FOUND: "We were unable to locate the GitHub repo connected to this site. Please contact support.", USER_NOT_IN_ORG: "You do not have access to this organization. Please contact an organization admin to be added.",