Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Nov 7, 2025

Fixes https://buildwithfern.slack.com/archives/C071SHP6UAY/p1762542385100039

Fail fast when docs.yml cannot be loaded in editor

Previously, when getDocsYmlAndReferences() failed (e.g., due to SITE_NOT_FOUND, DOCS_YML_MISSING, or transient GitHub API issues), the editor layout would log the error but continue rendering with latestDocsYmlAndReferences = null. 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. This error is caught by the [docsUrl]/error.tsx boundary, which displays the appropriate error message (e.g., "Your repository contains one or more Fern projects, but is missing a valid instance URL") with "Return home" and "Try again" buttons.

Additionally, added the missing DOCS_YML_MISSING error message to prevent users from seeing "Unknown error occurred" when docs.yml is missing.

What was the motivation & context behind this PR?

Customers reported seeing confusing error messages when accessing the Fern Editor:

  1. "Your repository contains one or more Fern projects, but is missing a valid instance URL" (intermittently on first load)
  2. "This file contains markdown that is not yet readable by the editor" (consistently after the first error)

Investigation revealed that the layout was continuing to render with null data when GitHub API calls failed, causing a cascade of errors downstream. The fix makes failures deterministic and provides clear, actionable error messages.

How has this PR been tested?

  • ✅ All lint checks passed (biome, style, yaml)
  • ✅ All CI checks passed
  • ✅ Code review verified error boundary handles digestible errors correctly
  • ⚠️ Not manually tested in staging/production - the error flow through the boundary should be verified manually before merge

Key Review Areas

  1. Error boundary behavior: Verify that [docsUrl]/error.tsx properly catches and displays all possible error digest types (SITE_NOT_FOUND, DOCS_YML_MISSING, NO_PROJECTS, REPO_NOT_FOUND, etc.)
  2. Breaking changes: Confirm there are no downstream components that were intentionally designed to handle null latestDocsYmlAndReferences
  3. Type narrowing: After the throw, we access docsYmlAndReferences.result directly - verify TypeScript compiles this correctly via control flow analysis
  4. Manual testing: Test the error scenarios in staging to confirm users see helpful error messages with working "Try again" functionality

Known Limitations

This PR improves error messaging but does not address the underlying intermittent GitHub API failures that cause errors like SITE_NOT_FOUND. Future improvements could include retry logic for transient failures.


Link to Devin run: https://app.devin.ai/sessions/c9b3ead2dfbf4f18a0619e25ecd94970
Requested by: [email protected]

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: [email protected] <[email protected]>
@vercel
Copy link
Contributor

vercel bot commented Nov 7, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
fern-dashboard Ready Ready Preview Nov 7, 2025 7:56pm
fern-dashboard-dev Ready Ready Preview Nov 7, 2025 7:56pm
ferndocs.com Ready Ready Preview Nov 7, 2025 7:56pm
5 Skipped Deployments
Project Deployment Preview Updated (UTC)
dev.ferndocs.com Ignored Ignored Preview Nov 7, 2025 7:56pm
fern-platform Ignored Ignored Nov 7, 2025 7:56pm
preview.ferndocs.com Skipped Skipped Nov 7, 2025 7:56pm
prod-assets.ferndocs.com Skipped Skipped Nov 7, 2025 7:56pm
prod.ferndocs.com Skipped Skipped Nov 7, 2025 7:56pm

@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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: [email protected] <[email protected]>
@devin-ai-integration
Copy link
Contributor Author

devin-ai-integration bot commented Nov 11, 2025

Closing as the issue was resolved through a different approach:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants