Skip to content

Incorrect Types in TOML Schema for lakefile.toml #11535

@maxwell3025

Description

@maxwell3025

Prerequisites

Please put an X between the brackets as you perform the following steps:

Description

When specifying a dependency in lakefile.toml using a subdirectory in a Git repository, the Even Better TOML extension flags this as a type error ({"url":"https://github.com/User/repo","subDir":"subdirectory"} is not of type "string") despite the Lean Language Reference stating that this is a valid configuration.
This is caused by src/lake/schemas/lakefile-toml-schema.json having an incorrect type for dependencyConfig.git.

According to https://lean-lang.org/doc/reference/latest/Build-Tools-and-Distribution/Lake/#Lake___Dependency-git, the git field in a require block in lakefile.toml may either be a string or a table with the shape

{
  url: String,
  subDir: String
}

Context

This came up when I was trying to add Aeneas as a dependency in a project.
I noticed that the standard installation procedure led to a lakefile.toml that had errors, but still compiled

Steps to Reproduce

  1. Either install Even Better TOML or install Taplo CLI.
  2. Create a Lean package that requires a Lean package from a subdirectory on Git. I've created an example repository at https://github.com/maxwell3025/lake-toml-minimal-example.
  3. Check lakefile.toml using the schema provided by Lean 4.
taplo lint --schema https://raw.githubusercontent.com/leanprover/lean4/refs/heads/master/src/lake/schemas/lakefile-toml-schema.json lakefile.toml

Expected behavior:
No errors should be displayed

Actual behavior:

 INFO taplo:lint_files:collect_files: found files total=1 excluded=0 files=["/home/maxwell/Repositories/lake-toml-minimal-example/lakefile.toml"] cwd="/home/maxwell/Repositories/lake-toml-minimal-example"
error: {"url":"https://github.com/AeneasVerif/aeneas","subDir":"backends/lean"} is not of type "string"
  ┌─ /home/maxwell/Repositories/lake-toml-minimal-example/lakefile.toml:9:7
  │
9 │ git = { url = "https://github.com/AeneasVerif/aeneas", subDir = "backends/lean" }
  │       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ {"url":"https://github.com/AeneasVerif/aeneas","subDir":"backends/lean"} is not of type "string"

error: {"url":"https://github.com/AeneasVerif/aeneas","subDir":"backends/lean"} is not of type "string"
  ┌─ /home/maxwell/Repositories/lake-toml-minimal-example/lakefile.toml:9:9
  │
9 │ git = { url = "https://github.com/AeneasVerif/aeneas", subDir = "backends/lean" }
  │         ^^^ {"url":"https://github.com/AeneasVerif/aeneas","subDir":"backends/lean"} is not of type "string"

error: {"url":"https://github.com/AeneasVerif/aeneas","subDir":"backends/lean"} is not of type "string"
  ┌─ /home/maxwell/Repositories/lake-toml-minimal-example/lakefile.toml:9:15
  │
9 │ git = { url = "https://github.com/AeneasVerif/aeneas", subDir = "backends/lean" }
  │               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ {"url":"https://github.com/AeneasVerif/aeneas","subDir":"backends/lean"} is not of type "string"

error: {"url":"https://github.com/AeneasVerif/aeneas","subDir":"backends/lean"} is not of type "string"
  ┌─ /home/maxwell/Repositories/lake-toml-minimal-example/lakefile.toml:9:56
  │
9 │ git = { url = "https://github.com/AeneasVerif/aeneas", subDir = "backends/lean" }
  │                                                        ^^^^^^ {"url":"https://github.com/AeneasVerif/aeneas","subDir":"backends/lean"} is not of type "string"

error: {"url":"https://github.com/AeneasVerif/aeneas","subDir":"backends/lean"} is not of type "string"
  ┌─ /home/maxwell/Repositories/lake-toml-minimal-example/lakefile.toml:9:65
  │
9 │ git = { url = "https://github.com/AeneasVerif/aeneas", subDir = "backends/lean" }
  │                                                                 ^^^^^^^^^^^^^^^ {"url":"https://github.com/AeneasVerif/aeneas","subDir":"backends/lean"} is not of type "string"

ERROR taplo:lint_files: invalid file error=schema validation failed path="/home/maxwell/Repositories/lake-toml-minimal-example/lakefile.toml"
ERROR operation failed error=some files were not valid

Versions

Tested with

  • Lake version 5.0.0-src (Lean version 4.27.0-nightly-2025-12-06)
  • Ubuntu 24.04.3 LTS
  • taplo 0.10.0
  • tamasfe.even-better-toml 0.21.2 (VS Code Extension)
  • VS Code 1.106.2

Additional Information

N/A

Impact

This affects DX.

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions