leanprover / leanprover/lean4

Bad error message "unknown parser declaration/category/alias `...`" when using a non-public syntax declaration from a public one.

Open
#14,075 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P-medium
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

Prerequisites
Description

This error message appears when using a non-public parser from a public one. This error message is confusing because the parser is known, and is similar cases with terms produce error messages that address the need for a public modifier.

It could also be remedied if the documentation on syntax would address this error explicitly and explain this case.

Context
Steps to Reproduce
  1. Open a new lean file.
  2. Paste the following:
module

syntax foo := ident
public syntax bar := foo

Expected behavior: An error explaining that syntax bar is public but uses a private parser foo

Actual behavior: The following error appears: "unknown parser declaration/category/alias foo"

Versions

Lean 4.32.0-nightly-2026-06-15
Target: x86_64-unknown-linux-gnu

Using live.lean-lang.org.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal Lean file from the Steps to Reproduce and run it against the latest nightly release or live.lean-lang.org. Trace how the public syntax bar := foo declaration resolves the private foo parser. Done means the diagnostic explains that public syntax bar uses a non-public parser, instead of reporting foo as unknown.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.