Skip to content

Commit 2a00592

Browse files
docs: add error message strings to relevant feature pages
Co-Authored-By: Devin Logan <devinannlogan@gmail.com>
1 parent 2df437d commit 2a00592

7 files changed

Lines changed: 113 additions & 1 deletion

File tree

fern/products/docs/pages/authentication/rbac.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,17 @@ Use the `<If />` component to [conditionally render content](/learn/docs/writing
7676
```
7777

7878
You can also combine `roles` with `products` and `versions` props.
79+
80+
## Common errors
81+
82+
<Accordion title='Role "X" is used but not declared at the top level of the docs.yml file.'>
83+
A `viewers:` entry or `<If roles={[...]}>` reference uses a role that isn't listed under the top-level `roles:` key in `docs.yml`. Add the role to the `roles` list:
84+
85+
```yaml title="docs.yml"
86+
roles:
87+
- everyone
88+
- partners
89+
- beta-users
90+
- admins
91+
```
92+
</Accordion>

fern/products/docs/pages/navigation/frontmatter.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ Frontmatter uses YAML syntax, but values are also processed as MDX. Some charact
3939
| `{` `}` `<` `>` | Escape with `\` | `title: "Using \<Callout\>"` |
4040
| `"` `'` | Opposite style or `\` | `title: 'The "best" practices'` |
4141

42+
<Info title='Error: "Failed to parse frontmatter"'>
43+
If `fern check` reports `Failed to parse frontmatter`, the YAML between the `---` markers is invalid. The most common cause is an unquoted value containing one of the special characters above. Wrap the value in quotes or escape the character and re-run `fern check`.
44+
</Info>
45+
4246
## Title
4347

4448
<ParamField path="title" type="string" required={false} default="Page name from docs.yml">

fern/products/docs/pages/navigation/tabs.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,20 @@ theme:
127127
Conditional display configuration
128128
</ParamField>
129129

130+
### Common tab errors
131+
132+
<AccordionGroup>
133+
<Accordion title='Tab "X" is missing from the tabs configuration.'>
134+
The `navigation` list references a tab key that isn't declared under the top-level `tabs` object. Add the tab to `tabs:` in `docs.yml` (with at least a `display-name`), or update the `- tab:` reference in `navigation` to match an existing key.
135+
</Accordion>
136+
<Accordion title='Tab "X" has both a href and layout. Only one should be used.'>
137+
A tab entry combines `href` with `layout` or `variants`. Use `href` for external links, or `layout`/`variants` for internal content — not both.
138+
</Accordion>
139+
<Accordion title='Tab "X" is missing a href, layout, or variants.'>
140+
Every tab in `navigation` must point somewhere. Add a `layout`, `variants`, or `href` to the tab entry.
141+
</Accordion>
142+
</AccordionGroup>
143+
130144
## Tab variants
131145

132146
Tab variants let you display different content variations within a single tab, and [support RBAC](/learn/docs/authentication/features/rbac). This is useful for showing different user types, implementation approaches, or experience levels without creating separate tabs.

fern/products/docs/pages/preview-publish/preview-changes-locally.mdx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,28 @@ Some features are disabled in local development:
4848
- Authentication
4949
</Note>
5050

51+
### Common errors
52+
53+
<AccordionGroup>
54+
<Accordion title="No docs.yml file found. Please make sure your project has one.">
55+
`fern docs dev` and `fern generate --docs` must be run from a directory that contains a `fern/` folder with a `docs.yml` inside. Change into your project directory, or create a `docs.yml` — see [Project structure](/learn/docs/getting-started/project-structure).
56+
</Accordion>
57+
<Accordion title="Broken link to /some/path (resolved path: ...)">
58+
`fern check` reports this when a link in a Markdown page doesn't resolve to a real page, anchor, or file in your docs.
59+
60+
- For internal pages, use the [published URL path](/learn/docs/writing-content/markdown-basics#link-format) from your `docs.yml` config (for example, `/learn/docs/configuration/navigation`) — not a relative path or on-disk file path.
61+
- For images and other assets, use a path relative to the Markdown file.
62+
63+
Broken internal links fail by default. Use [`fern generate --docs --no-strict-broken-links`](/learn/cli-api-reference/cli-reference/commands#fern-generate) to downgrade the failure to a warning while you fix them.
64+
</Accordion>
65+
<Accordion title="Invalid URL: /some/path">
66+
A Markdown link or `<img src>` uses a value that isn't a valid URL. Check for typos, unescaped characters, or missing protocols on external links.
67+
</Accordion>
68+
<Accordion title="Path ./pages/foo.mdx does not exist">
69+
A `path:` in `docs.yml` points to a file that isn't on disk. Fix the path or create the missing file. Paths are relative to the YAML file that defines them.
70+
</Accordion>
71+
</AccordionGroup>
72+
5173
## Preview links
5274

5375
Generate shareable preview URLs to review and collaborate on documentation changes before publishing. Preview links aren't indexed by search engines and don't expire.

fern/products/docs/pages/preview-publish/publishing-your-docs.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,14 @@ If you need access to your docs offline or would like to host your docs on your
192192

193193
To unpublish a docs site, navigate to the **Settings** page for your site in the [Fern Dashboard](https://dashboard.buildwithfern.com) and click **Unpublish**. This makes the domain no longer publicly accessible, but doesn't delete the site — you can republish it at any time. This is useful for creating draft sites or temporarily hiding a site from public view.
194194

195+
## Common errors
196+
197+
<AccordionGroup>
198+
<Accordion title="No token found. Please set the FERN_TOKEN environment variable or run `fern login`.">
199+
`fern generate --docs` needs an authenticated session to publish. Run `fern login` locally, or set `FERN_TOKEN` in your shell or CI environment. Use [`fern token`](/learn/cli-api-reference/cli-reference/commands#fern-token) to generate a CI-friendly token.
200+
</Accordion>
201+
<Accordion title="OpenAPI spec validation failed with N errors. Fix the errors above before generating docs.">
202+
One or more OpenAPI specs referenced by the docs have fatal validation errors. The individual `<file>: <message>` lines above this message identify the exact problem — fix those in your spec, then re-run `fern generate --docs`.
203+
</Accordion>
204+
</AccordionGroup>
205+

fern/products/docs/pages/preview-publish/setting-up-your-domain.mdx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,22 @@ Once Fern has completed your setup, you'll be able to access your documentation
197197
</Accordion>
198198
</AccordionGroup>
199199
200+
### Common errors
201+
202+
Errors below are surfaced by `fern check` and `fern generate --docs` when validating the `instances[].url` values in `docs.yml`.
203+
204+
<AccordionGroup>
205+
<Accordion title='Invalid URL format: "X". Expected format: <subdomain>.docs.buildwithfern.com'>
206+
The `url` is missing a subdomain or uses an unexpected shape. Use `<your-org>.docs.buildwithfern.com` (for example, `plantstore.docs.buildwithfern.com`). Don't include `https://`.
207+
</Accordion>
208+
<Accordion title='Invalid domain in URL "X". The URL must end with one of: docs.buildwithfern.com, docs.dev.buildwithfern.com'>
209+
The `url` doesn't end with a supported Fern domain. Update the `url` to end with `docs.buildwithfern.com`. Configure your vanity domain separately with `custom-domain`.
210+
</Accordion>
211+
<Accordion title='Invalid URL "X". A subdomain is required before docs.buildwithfern.com'>
212+
The `url` is set to the bare domain. Add a subdomain prefix such as `<your-org>.docs.buildwithfern.com`.
213+
</Accordion>
214+
</AccordionGroup>
215+
200216
### Multiple custom domains
201217
202218
To serve your documentation from multiple custom domains (e.g., for partner or white-label deployments), follow the above steps for each domain (subdomain, subpath, or root domain), then configure an array in your `docs.yml`:
@@ -211,4 +227,4 @@ instances:
211227

212228
<Info>
213229
After configuring multiple domains in your `docs.yml`, contact Fern via your dedicated Slack channel or [email](mailto:support@buildwithfern.com) to complete the setup. You'll receive DNS configuration details for each domain.
214-
</Info>
230+
</Info>

fern/products/docs/pages/seo/redirects.mdx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,34 @@ subtitle: Learn how to configure redirects in Fern Docs. Set up exact path redir
1212
To add external links to your sidebar navigation, see [Navigation](/learn/docs/configuration/navigation#links).
1313
</Tip>
1414

15+
## Common errors
16+
17+
Errors below are surfaced by `fern check` and `fern generate --docs`.
18+
19+
<AccordionGroup>
20+
<Accordion title='Page "X" was moved from "/old" to "/new". The old URL will return 404 without a redirect.'>
21+
A page's slug changed relative to the last published version of your docs. Add a redirect in `docs.yml` so existing links keep working:
22+
23+
```yaml title="docs.yml"
24+
redirects:
25+
- source: /old
26+
destination: /new
27+
```
28+
</Accordion>
29+
<Accordion title='Page "X" was removed. The previously published URL "/old" will return 404 without a redirect.'>
30+
A published page no longer exists in the navigation. Add a redirect to another relevant page to avoid breaking incoming links:
31+
32+
```yaml title="docs.yml"
33+
redirects:
34+
- source: /old
35+
destination: /new-home
36+
```
37+
</Accordion>
38+
<Accordion title='Redirect from "/path" to "/path" creates an infinite loop (source equals destination).'>
39+
A redirect's `source` and `destination` are the same path. Remove the redirect or point the `destination` at a different URL.
40+
</Accordion>
41+
<Accordion title="Circular redirect chain detected: /a → /b → /a">
42+
Two or more redirects form a cycle. Update the chain so each `source` eventually resolves to a single final `destination`.
43+
</Accordion>
44+
</AccordionGroup>
45+

0 commit comments

Comments
 (0)