Skip to content

Fix #3023: Improve error message for invalid Font Awesome icons#3037

Merged
ehuss merged 1 commit intorust-lang:masterfrom
cobyfrombrooklyn-bot:fix-issue-3023
Feb 27, 2026
Merged

Fix #3023: Improve error message for invalid Font Awesome icons#3037
ehuss merged 1 commit intorust-lang:masterfrom
cobyfrombrooklyn-bot:fix-issue-3023

Conversation

@cobyfrombrooklyn-bot
Copy link
Copy Markdown

@cobyfrombrooklyn-bot cobyfrombrooklyn-bot commented Feb 24, 2026

Problem

When an invalid Font Awesome icon name is used in book.toml (e.g. git-repository-icon = "fa-github"), the error message is cryptic:

Caused by: Missing font github

This leaves users confused about what went wrong and how to fix it, especially since fa-github was suggested by older documentation.

Fix

Improved the error message in the fa_helper handlebars helper to include:

  • The icon name that was looked up
  • The icon type that was searched (brands/regular/solid)
  • The valid prefix options (fas, fab, far)
  • A link to the FontAwesome v6 free icon gallery

After:

Unknown Font Awesome icon `github` for type `regular`. Hint: check the icon name and prefix (fas (solid), fab (brands), or far (regular)) at https://fontawesome.com/v6/search?m=free

Test

Added fontawesome_error_message integration test that:

  • Configures git-repository-icon = "fa-github" (a common mistake — should be fab-github)
  • Verifies the build fails with the improved error message
  • Uses [..] wildcards for line/col numbers so the test is stable across template changes

Full test suite passes on macOS ARM (Apple Silicon): 251 passed, 0 failed.

Fixes #3023

When an invalid Font Awesome icon name is used (e.g. in git-repository-icon),
the error message now includes the icon name, the type that was searched,
valid prefix options (fas/fab/far), and a link to the FontAwesome icon gallery.

Before: Missing font github
After:  Unknown Font Awesome icon `github` for type `regular`. Hint: check
        the icon name and prefix (fas (solid), fab (brands), or far (regular))
        at https://fontawesome.com/v6/search?m=free

Fixes rust-lang#3023
@rustbot rustbot added the S-waiting-on-review Status: waiting on a review label Feb 24, 2026
Copy link
Copy Markdown
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

It's a bit unfortunate the error message is duplicated, but it seems it's not something we can control.

View changes since this review

@ehuss ehuss added this pull request to the merge queue Feb 27, 2026
Merged via the queue into rust-lang:master with commit 33f76c0 Feb 27, 2026
15 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: waiting on a review label Feb 27, 2026
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.

Can we have a clearer error message than "Caused by: Missing font github"?

3 participants