Skip to content

bug: TypeError: Project.__init__() got an unexpected keyword argument 'schema_version' #27

@mjozan-rte

Description

@mjozan-rte

Description of the bug

Hello,

I have an bug when running mkdocs build in any project where I launch the command (tested on mac and linux).

To Reproduce

Here is a small project that I took from an other issue where I have the bug:
bug2.zip

Full traceback

➜  docs mkdocs build
INFO    -  Cleaning site directory
INFO    -  Building documentation to directory: /Users/homefolder/Downloads/docs/site
ERROR   -  Error reading page 'index.md': Project.__init__() got an unexpected keyword argument 'schema_version'
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.12/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/mkdocs/__main__.py", line 288, in build_command
    build.build(cfg, dirty=not clean)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/mkdocs/commands/build.py", line 310, in build
    _populate_page(file.page, config, files, dirty)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/mkdocs/commands/build.py", line 167, in _populate_page
    page.render(config, files)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/mkdocs/structure/pages.py", line 285, in render
    self.content = md.convert(self.markdown)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/markdown/core.py", line 357, in convert
    root = self.parser.parseDocument(self.lines).getroot()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/markdown/blockparser.py", line 117, in parseDocument
    self.parseChunk(self.root, '\n'.join(lines))
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/markdown/blockparser.py", line 136, in parseChunk
    self.parseBlocks(parent, text.split('\n\n'))
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/markdown/blockparser.py", line 158, in parseBlocks
    if processor.run(parent, blocks) is not False:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/mkdocstrings/_internal/extension.py", line 126, in run
    html, handler, data = self._process_block(identifier, block, heading_level)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/mkdocstrings/_internal/extension.py", line 189, in _process_block
    data: CollectorItem = handler.collect(identifier, options)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/mkdocstrings_handlers/typescript/_internal/handler.py", line 89, in collect
    data = load_typedoc(["typedoc"])
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/griffe_typedoc/_internal/loader.py", line 63, in load
    return json.load(tmpfile, cls=TypedocDecoder)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/json/__init__.py", line 293, in load
    return loads(fp.read(),
           ^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/json/__init__.py", line 359, in loads
    return cls(**kw).decode(s)
           ^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/json/decoder.py", line 338, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/json/decoder.py", line 354, in raw_decode
    obj, end = self.scan_once(s, idx)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/griffe_typedoc/_internal/decoder.py", line 563, in _object_hook
    return _loader_map[kind](obj_dict, self._symbol_map)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/griffe_typedoc/_internal/decoder.py", line 70, in wrapper
    obj = func(obj_dict)
          ^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/griffe_typedoc/_internal/decoder.py", line 105, in _load_project
    return Project(**obj_dict)
           ^^^^^^^^^^^^^^^^^^^
TypeError: Project.__init__() got an unexpected keyword argument 'schema_version'

Expected behavior

Environment information

python -m mkdocstrings_handlers.typescript._internal.debug  # | xclip -selection clipboard
  • System: macOS-15.3.1-arm64-arm-64bit
  • Python: cpython 3.12.9 (/Library/Frameworks/Python.framework/Versions/3.12/bin/python3)
  • Environment variables:
  • Installed packages:
    • mkdocstrings-typescript v0.1.0

Here are my installed packages:

mkdocstrings==0.29.1
mkdocstrings-typescript==0.1.0
mkdocs==1.6.1

Additional context

Metadata

Metadata

Assignees

Labels

unconfirmedThis bug was not reproduced yet

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions