Incorrect "No parameter named" Warning
Type: Bug
This is a hard error to describe, and I have found no way to reliably replicate it. But it does show up in most of my own code projects, so I will do my best to describe it.
Pylance warns me during the initialization of a class, that there is no parameter called XXX, as seen in the picture.
The warning is raised for every single parameter in the class.
But as you can see, all of the parameters are exactly correctly called. The names match up.
My current workaround for getting the error to disappear is this:
When editing the file, such as just adding a line break, the warning disappears.
This behavior too is hard to replicate. Sometimes multiple edits are required.
Sometimes the warning comes back when you undo the change, and sometimes it stays fixed.
I've had this problematic behavior popping up for several months now, over the last multiple vscode versions. Some guesses on my part to help narrow the problem down more:
- This problem only seems to appear for classes that are
attrdecorated, such as the example one:
@attrs(hash=True, slots=True, eq=True, kw_only=True, frozen=True, order=True, init=True)
class Monthly_Euro_Worth:
"""
## Description:
A class that describes how much a single unit of the given `currency` would be worth in Euro.
"""
month_period: Month_Period = field(validator=(validators.instance_of(Month_Period)))
worth_to_euro: Decimal = field(validator=(validators.instance_of(Decimal)))
spreadsheet_cell_source: Spreadsheet_Cell_Source = field(
validator=(validators.instance_of(Spreadsheet_Cell_Source))
)
currency: Currency = field(validator=(validators.instance_of(Currency)))
- The problem only seems to appear when the structure is larger. So when the whole project only contains one or two attr classes that are being referenced, everything is fine. But larger projects with many such classes have this problem happening much more often.
Let me know if you have additional questions that I might be able to help clear up.
Extension version: 2025.5.1 VS Code version: Code 1.100.1 (91fa95bccb027ece6a968589bb1d662fa9c8e170, 2025-05-09T15:43:50.040Z) OS version: Windows_NT x64 10.0.19045 Modes:
System Added Logs
2025-05-15 17:45:11.126 [info] (Client) Pylance async client (2025.5.1) started with python extension (2025.6.0)
2025-05-15 17:45:15.200 [info] [Info - 5:45:15 PM] (42484) Server root directory: file:///c%3A/Users/David/.vscode/extensions/ms-python.vscode-pylance-2025.5.1/dist
2025-05-15 17:45:15.201 [info] [Info - 5:45:15 PM] (42484) Pylance language server 2025.5.1 (pyright version 1.1.400, commit b962ffc2) starting
2025-05-15 17:45:15.213 [info] [Info - 5:45:15 PM] (42484) Starting service instance "picti_taxes" for workspace "l:\Finances\Steuer\Calculations\Automation\picti_taxes"
2025-05-15 17:45:15.663 [info] [Info - 5:45:15 PM] (42484) Loading pyproject.toml file at l:\Finances\Steuer\Calculations\Automation\picti_taxes\pyproject.toml
2025-05-15 17:45:15.675 [info] [Info - 5:45:15 PM] (42484) Setting environmentName for service "picti_taxes": "3.13.1 (.venv venv)"
2025-05-15 17:45:15.710 [info] [Info - 5:45:15 PM] (42484) Setting pythonPath for service "picti_taxes": "L:\Finances\Steuer\Calculations\Automation\picti_taxes\.venv\Scripts\python.exe"
2025-05-15 17:45:15.718 [info] [Info - 5:45:15 PM] (42484) No include entries specified; assuming l:\Finances\Steuer\Calculations\Automation\picti_taxes
2025-05-15 17:45:15.980 [info] [Info - 5:45:15 PM] (42484) Assuming Python version 3.13.1.final.0
2025-05-15 17:45:20.176 [info] [Info - 5:45:20 PM] (42484) Found 468 source files
2025-05-15 17:45:20.274 [info] [Info - 5:45:20 PM] (42484) BG: Priority queue background worker(2) root directory: file:///c%3A/Users/David/.vscode/extensions/ms-python.vscode-pylance-2025.5.1/dist
2025-05-15 17:45:20.274 [info] [Info - 5:45:20 PM] (42484) BG: Priority queue background worker(2) started
2025-05-15 17:45:20.289 [info] [Info - 5:45:20 PM] (42484) Loading pyproject.toml file at l:\Finances\Steuer\Calculations\Automation\picti_taxes\pyproject.toml
2025-05-15 17:45:20.301 [info] [Info - 5:45:20 PM] (42484) Setting environmentName for service "picti_taxes": "3.13.1 (.venv venv)"
2025-05-15 17:45:20.305 [info] [Info - 5:45:20 PM] (42484) Setting pythonPath for service "picti_taxes": "L:\Finances\Steuer\Calculations\Automation\picti_taxes\.venv\Scripts\python.exe"
2025-05-15 17:45:20.306 [info] [Info - 5:45:20 PM] (42484) No include entries specified; assuming l:\Finances\Steuer\Calculations\Automation\picti_taxes
2025-05-15 17:45:20.611 [info] [Info - 5:45:20 PM] (42484) Assuming Python version 3.13.1.final.0
2025-05-15 17:45:22.888 [info] [Info - 5:45:22 PM] (42484) Found 468 source files
2025-05-15 17:45:26.714 [info] [Info - 5:45:26 PM] (42484) BG: [BG(1)] Long operation: checking: file:///l%3A/Finances/Steuer/Calculations/Automation/picti_taxes/picti_taxes/accountants/accountant_base.py (3189ms)
2025-05-15 17:45:26.715 [info] [Info - 5:45:26 PM] (42484) BG: [BG(1)] Long operation: analyzing: file:///l%3A/Finances/Steuer/Calculations/Automation/picti_taxes/picti_taxes/accountants/accountant_base.py (3215ms)
2025-05-15 17:45:33.589 [info] [Info - 5:45:33 PM] (42484) BG: [BG(1)] Long operation: checking: file:///l%3A/Finances/Steuer/Calculations/Automation/picti_taxes/picti_taxes/accountants/accountant_splitter.py (6190ms)
2025-05-15 17:45:33.589 [info] [Info - 5:45:33 PM] (42484) BG: [BG(1)] Long operation: analyzing: file:///l%3A/Finances/Steuer/Calculations/Automation/picti_taxes/picti_taxes/accountants/accountant_splitter.py (6873ms)
2025-05-15 19:25:08.311 [info] [Info - 7:25:08 PM] (42484) BG: Indexer background runner(3) root directory: file:///c%3A/Users/David/.vscode/extensions/ms-python.vscode-pylance-2025.5.1/dist (index)
2025-05-15 19:25:08.311 [info] [Info - 7:25:08 PM] (42484) BG: Indexing(3) started
2025-05-15 19:25:13.813 [info] [Info - 7:25:13 PM] (42484) BG: [IDX(3)] Long operation: scan packages file:///l%3A/Finances/Steuer/Calculations/Automation/picti_taxes (5119ms)
2025-05-15 19:25:13.813 [info] [Info - 7:25:13 PM] (42484) BG: scanned(3) 158 files over 1 exec env
2025-05-15 19:25:14.191 [info] [Info - 7:25:14 PM] (42484) BG: indexed(3) 158 files over 1 exec env
2025-05-15 19:25:14.250 [info] [Info - 7:25:14 PM] (42484) BG: Indexing finished(3).
2025-05-15 21:43:57.394 [info] [Info - 9:43:57 PM] (42484) Found 468 source files
System Info
| Item | Value |
|---|---|
| CPUs | AMD Ryzen Threadripper 2970WX 24-Core Processor (48 x 2994) |
| GPU Status | 2d_canvas: enabled canvas_oop_rasterization: enabled_on direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_graphite: disabled_off video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: enabled webnn: disabled_off |
| Load (avg) | undefined |
| Memory (System) | 95.88GB (52.76GB free) |
| Process Argv | --crash-reporter-id 0f924fbb-88c9-44bf-bd09-f8e30396fdf9 |
| Screen Reader | no |
| VM | 0% |
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
vscaat:30438848
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
h48ei257:31000450
pythontbext0:30879054
cppperfnew:31000557
dwnewjupytercf:31046870
pythonrstrctxt:31112756
nativeloc1:31192215
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
customenabled:31248079
hdaa2157:31222309
copilot_t_ci:31222730
e5gg6876:31282496
pythoneinst12:31285622
bgtreat:31268568
4gafe986:31271826
c7cif404:31308204
31787653:31262186
3e8i5726:31271747
996jf627:31283433
pythonrdcb7cf:31303019
usemplatestapi:31297334
0aa6g176:31307128
7bj51361:31289155
747dc170:31275177
aj953862:31281341
generatesymbolt:31295002
convertfstringf:31295003
gendocf:31295004
Could you provide a minimal repro case, preferably self-contained? Debugging issues from partial screen shots isn't possible in most cases.
That's the very thing that's hard to do in this case. Because the problem disappears when you do most any edit, I don't know how big the smallest repro case would have to be. It only tends to show up in large code bases (which contain private code, so I can't share those either.)
Would it maybe be possible to enable detailed logging on the "No parameter named" warning to see why the stack of its reasoning?
Logging won't really help here. I'd need to see a repro case. Are you saying that the problem randomly appears and disappears, or is it deterministic? If it's deterministic, I recommend starting with a case where the problem appears, then methodically paring back the example until the error message disappears. That will help you get to the heart of the issue — and often times lead you to an understanding of why the error is being reported. For example, if you remove all of the parameters other than currency, does that make the error disappear, or does some combination of parameters appear to be needed to make the error appear?
I'm seeing a similar if not identical issue and it's extremely intermittent. It appears that somtimes when opening files within a larger project, pylance will emit some spurious errors. For example:
The type it's complaining about does of course have those fields:
@dataclass(kw_only=True, slots=True)
class ActivityHandle[ActivityStateT: ActivityState = ActivityState](ChangeNotifier):
activity: IActivity[ActivityStateT]
provider: Provider
id: int = 0
name: str = field(default="")
But that's not the issue. The issue isn't that it gives an invalid error message, it's that it only does this sometimes. As @RealTachyon mentioned, you can get it to snap out of it by:
- Making any change to the file, like inserting a newline and deleting it.
- Restarting the language server.
Of course, running pyright in the terminal also seems okay with things.
It happens annoyingly often but not in a way that I can consistently reproduce yet.