forem/forem · error · StandardError
GitHub tag: invalid options: %{invalid} | supported options:
Error message
GitHub tag: invalid options: %{invalid} | supported options: %{valid} What it means
{% github <owner>/<repo> [option] %} renders a repository card, optionally without its README. validate_options! accepts an empty option list or options drawn entirely from NOREADME_OPTIONS = %w[no-readme noreadme]; any other token (or a mix that includes one) raises with the invalid tokens and the valid list interpolated into the message.
Source
Thrown at app/liquid_tags/github_tag/github_readme_tag.rb:55
path, *options = sanitized_input.split
validate_options!(*options)
path.delete_suffix!("/") # remove optional trailing forward slash
repository_path = Addressable::URI.parse(path)
repository_path.query = repository_path.fragment = nil
[repository_path.normalize.to_s, options]
end
def validate_options!(*options)
return if options.empty?
return if options.all? { |o| NOREADME_OPTIONS.include?(o) }
message = I18n.t("liquid_tags.github_tag.github_readme_tag.invalid_options",
invalid: (options - NOREADME_OPTIONS), valid: NOREADME_OPTIONS)
raise StandardError, message
end
def show_readme?
options.none?
end
def fetch_readme(repository_path, repository_url)
readme_html = Github::OauthClient.new.readme(repository_path, accept: "application/vnd.github.html")
clean_relative_path!(readme_html, repository_url)
rescue Github::Errors::NotFound
nil
end
def sanitize_input(input)
ActionController::Base.helpers.strip_tags(input)
.gsub(GITHUB_DOMAIN_REGEXP, "")
.strip
endView on GitHub (pinned to f354c376a7)
Solutions
- Use exactly no-readme or noreadme: {% github user/repo noreadme %}.
- Pass no option at all to render the repository card with its README.
- Remove any extra tokens after the path — everything after the first space is treated as options.
Example fix
// before
{% github forem/forem no_readme %}
// after
{% github forem/forem noreadme %} Defensive patterns
Strategy: validation
Validate before calling
path, *options = input.gsub(%r{.*github\.com/}, '').split
valid = options.empty? || options.all? { |o| %w[no-readme noreadme].include?(o) } Type guard
def github_readme_options_valid?(input)
_path, *options = input.gsub(%r{.*github\.com/}, '').split
options.empty? || options.all? { |o| GithubTag::GithubReadmeTag::NOREADME_OPTIONS.include?(o) }
end Try / catch
begin GithubTag::GithubReadmeTag.new(input) rescue StandardError => e errors << e.message end
Prevention
- Offer the two flags (no-readme, noreadme) from a dropdown rather than free text.
- Trim stray tokens after the repo path — they are parsed as options.
- Reference NOREADME_OPTIONS in docs so the vocabulary stays in sync.
When it happens
Trigger: {% github user/repo no_readme %} (underscore instead of hyphen); {% github user/repo hide-readme %}; {% github user/repo noreadme extra %} (valid option mixed with an unknown one fails the .all? check); duplicated tokens like noreadme noreadme are fine since both are whitelisted.
Common situations: Author guesses the flag spelling from another tag's vocabulary (underscore vs hyphen vs the two accepted spellings); a doc example from an older revision used a different flag; extra text accidentally left after the option.
Related errors
- Invalid Options
- Invalid Blogcast ID
- Invalid Bluesky URL
- Feed tag requires at least one source: org, tag, or tags
- Tags option requires at least one tag name
AI-assisted analysis of forem/forem@f354c376a7 (2026-08-21).
Data as JSON: /api/errors/139ab08e3c50016d.
Report an issue: GitHub.