linkding-cli icon indicating copy to clipboard operation
linkding-cli copied to clipboard

TypeError: Parameter.make_metavar() missing 1 required positional argument: 'ctx'

Open justsh opened this issue 4 months ago • 3 comments

Describe the bug Trying to run linkding --help raises TypeError: Parameter.make_metavar() missing 1 required positional argument: 'ctx'

To Reproduce Steps to reproduce the behavior:

  1. Install linkding-cli from PyPI
    $ uv tool install linkding-cli                                  
    Resolved 23 packages in 422ms
    Prepared 2 packages in 163ms
    Installed 23 packages in 14ms
     + aiohappyeyeballs==2.6.1
     + aiohttp==3.12.15
     + aiolinkding==2025.2.0
     + aiosignal==1.4.0
     + attrs==25.3.0
     + certifi==2025.8.3
     + click==8.2.1
     + frozenlist==1.5.0
     + idna==3.10
     + linkding-cli==2024.9.0
     + markdown-it-py==4.0.0
     + mdurl==0.1.2
     + multidict==6.6.4
     + packaging==24.2
     + propcache==0.3.2
     + pygments==2.19.2
     + rich==14.1.0
     + ruamel-yaml==0.18.15
     + ruamel-yaml-clib==0.2.12
     + shellingham==1.5.4
     + typer==0.12.5
     + typing-extensions==4.15.0
     + yarl==1.20.1
    warning: The package `typer==0.12.5` does not have an extra named `all`
    Installed 1 executable: linkding
    
  2. Run linkding --help
    
     Usage: linkding [OPTIONS] COMMAND [ARGS]...
    
     Interact with a linkding instance.
     Args:     ctx: A Typer Context object.     config: A path to a config file     token: A linkding API token.     url: A URL to a linkding instance.
     verbose: Increase verbosity of standard output.
    
    ╭────────────────────────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────────────────────╮
    │ /home/justsh/.local/bin/linkding:10 in <module>                                                                                                   │
    │                                                                                                                                                       │
    │    7 │   │   sys.argv[0] = sys.argv[0][:-11]                                                  ╭───────────────────── locals ──────────────────────╮   │
    │    8 │   elif sys.argv[0].endswith(".exe"):                                                   │ APP = <typer.main.Typer object at 0x7f9323f4d820> │   │
    │    9 │   │   sys.argv[0] = sys.argv[0][:-4]                                                   │ sys = <module 'sys' (built-in)>                   │   │
    │ ❱ 10 │   sys.exit(APP())                                                                      ╰───────────────────────────────────────────────────╯   │
    │   11                                                                                                                                                  │
    │                                                                                                                                                       │
    │ /home/justsh/.local/share/uv/tools/linkding-cli/lib/python3.12/site-packages/typer/main.py:338 in __call__                                        │
    │                                                                                                                                                       │
    │ /home/justsh/.local/share/uv/tools/linkding-cli/lib/python3.12/site-packages/typer/main.py:321 in __call__                                        │
    │                                                                                                                                                       │
    │ /home/justsh/.local/share/uv/tools/linkding-cli/lib/python3.12/site-packages/click/core.py:1442 in __call__                                       │
    │                                                                                                                                                       │
    │ /home/justsh/.local/share/uv/tools/linkding-cli/lib/python3.12/site-packages/typer/core.py:728 in main                                            │
    │                                                                                                                                                       │
    │ /home/justsh/.local/share/uv/tools/linkding-cli/lib/python3.12/site-packages/typer/core.py:196 in _main                                           │
    │                                                                                                                                                       │
    │ /home/justsh/.local/share/uv/tools/linkding-cli/lib/python3.12/site-packages/click/core.py:1186 in make_context                                   │
    │                                                                                                                                                       │
    │ /home/justsh/.local/share/uv/tools/linkding-cli/lib/python3.12/site-packages/click/core.py:1786 in parse_args                                     │
    │                                                                                                                                                       │
    │ /home/justsh/.local/share/uv/tools/linkding-cli/lib/python3.12/site-packages/click/core.py:1197 in parse_args                                     │
    │                                                                                                                                                       │
    │ /home/justsh/.local/share/uv/tools/linkding-cli/lib/python3.12/site-packages/click/core.py:2416 in handle_parse_result                            │
    │                                                                                                                                                       │
    │ /home/justsh/.local/share/uv/tools/linkding-cli/lib/python3.12/site-packages/click/core.py:2355 in process_value                                  │
    │                                                                                                                                                       │
    │ /home/justsh/.local/share/uv/tools/linkding-cli/lib/python3.12/site-packages/click/decorators.py:539 in show_help                                 │
    │                                                                                                                                                       │
    │ /home/justsh/.local/share/uv/tools/linkding-cli/lib/python3.12/site-packages/click/core.py:730 in get_help                                        │
    │                                                                                                                                                       │
    │ /home/justsh/.local/share/uv/tools/linkding-cli/lib/python3.12/site-packages/click/core.py:1064 in get_help                                       │
    │                                                                                                                                                       │
    │ /home/justsh/.local/share/uv/tools/linkding-cli/lib/python3.12/site-packages/typer/core.py:742 in format_help                                     │
    │                                                                                                                                                       │
    │ /home/justsh/.local/share/uv/tools/linkding-cli/lib/python3.12/site-packages/typer/rich_utils.py:611 in rich_format_help                          │
    │                                                                                                                                                       │
    │ /home/justsh/.local/share/uv/tools/linkding-cli/lib/python3.12/site-packages/typer/rich_utils.py:370 in _print_options_panel                      │
    ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
    TypeError: Parameter.make_metavar() missing 1 required positional argument: 'ctx'
    

Expected behavior The help text is shown

Screenshots N/A

Additional context This affects other projects using typer with an unpinned click: https://github.com/fastapi/typer/discussions/1215 The pin was added to typer version 0.15.4 via typer/fastapi#1225

The solution seems to either be to add the click pin directly in linkding-cli in order to maintain linkding-cli's broader range of typer version compatibility, or drop older versions of typer altogether.

justsh avatar Sep 08 '25 18:09 justsh

There hasn't been any activity on this issue recently, so it has been marked as stale. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment. This issue will be closed if no further activity occurs. Thanks!

github-actions[bot] avatar Oct 09 '25 08:10 github-actions[bot]

not stale

justsh avatar Oct 10 '25 18:10 justsh

I installed today using "pip install linkding". ( in a venv ) and I get the same error as above when using --help.

I have not found any combination of command-line arguments/environment variables/config file which enable the tool to work.

I tried setting environment variables LINKDING_URL and LINKDING_TOKEN to no avail, it complains about missing context, e.g.

LINKDING_TOKEN="redacted"  LINKDING_URL="http://192.168.1.232:9090" linkding bookmarks all
2025-11-01 15:48:08,339 | linkding_cli | DEBUG | Command: bookmarks
2025-11-01 15:48:08,339 | linkding_cli | DEBUG | Arguments: []
2025-11-01 15:48:08,339 | linkding_cli | DEBUG | Options: {'config': None, 'token': None, 'url': None, 'verbose': 'False'}
2025-11-01 15:48:08,339 | linkding_cli | ERROR | Missing required option: --token
2025-11-01 15:48:08,340 | linkding_cli | DEBUG |   File "/Users/mjb/.venv/linkding/lib/python3.13/site-packages/linkding_cli/helpers/logging.py", line 81, in wrapper
    return cast(dict[str, Any], func(*args, **kwargs))
                                ~~~~^^^^^^^^^^^^^^^^^
  File "/Users/mjb/.venv/linkding/lib/python3.13/site-packages/linkding_cli/cli.py", line 65, in main
    ctx.obj = LinkDing(ctx)
              ~~~~~~~~^^^^^
  File "/Users/mjb/.venv/linkding/lib/python3.13/site-packages/linkding_cli/core.py", line 36, in __init__
    self.config = Config(ctx)
                  ~~~~~~^^^^^
  File "/Users/mjb/.venv/linkding/lib/python3.13/site-packages/linkding_cli/config.py", line 54, in __init__
    raise ConfigError(f"Missing required option: --{param}")

I tried specifying a config file as shown on the home page, to no avail ...

linkding --config /Users/mjb/.linkding.json --url http://192.168.1.232:9090 bookmarks
Usage: linkding [OPTIONS] COMMAND [ARGS]...
Try 'linkding --help' for help.
╭─ Error ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ No such command '/Users/mjb/.linkding.json'.      

mjbright avatar Nov 01 '25 14:11 mjbright

There hasn't been any activity on this issue recently, so it has been marked as stale. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment. This issue will be closed if no further activity occurs. Thanks!

github-actions[bot] avatar Dec 02 '25 08:12 github-actions[bot]