Skip to content

reflect-metadata 0.2.x vs 0.1.x global registry clobbering causes "Missing required @injectable annotation" in Python & Jupyter #26320

Backlog

Description

@Xloxkwize

Environment

  • VS Code: 1.148.0 (661626d0e72f97806550790a98fb87116c9db825, Linux x64)
  • ms-python.python: 2026.10.0 (also reproduced on 2026.11.2026110601)
  • ms-python.vscode-python-envs: 1.44.0 (also reproduced on 1.45.2026112601)
  • ms-toolsai.jupyter: 2025.9.1 (also reproduced on 2026.6.2026071501)

Symptoms

  1. ms-python.python fails to activate ("Python extension loading..." indefinitely):
    [error] Error: Missing required @injectable annotation in: C.
    
  2. ms-toolsai.jupyter fails to create notebook controllers (kernel/environment picker bounces back to "Select Another Kernel"):
    [error] Failed to create notebook controller for ... [Error: Missing required @inject or @multiInject annotation in: argument 0 in class kb.
    
    (and Missing required @injectable annotation in: wb.)

Root Cause

ms-python.python bundles reflect-metadata 0.2.x (uses Symbol.for("@reflect-metadata:registry")), whereas ms-python.vscode-python-envs and ms-toolsai.jupyter bundle reflect-metadata 0.1.x (closure-scoped MetadataProvider, no @reflect-metadata:registry).

When extensions activate out of order in the same extension host:

  • Whichever copy of reflect-metadata installs/replaces the global Reflect.* functions last makes classes decorated under the other version's store invisible to InversifyJS.
  • Neither ms-python.python (depending on ms-python.vscode-python-envs) nor ms-toolsai.jupyter (depending on ms-python.python) enforces the required activation order in extensionDependencies.

Verification / Workaround

Enforcing the activation order ms-python.vscode-python-envs → ms-python.python → ms-toolsai.jupyter via package.json:

  • ms-python.python: "extensionDependencies": ["ms-python.vscode-python-envs"]
  • ms-toolsai.jupyter: "extensionDependencies": ["ms-python.python"]

In an isolated test with the same user settings, globalStorage, and workspace/notebook:

  • Python DI errors: 1 → 0
  • Jupyter DI / controller creation errors: 28–36 → 0

Suggested Fix

  1. Align reflect-metadata across ms-python.python, ms-python.vscode-python-envs, and ms-toolsai.jupyter (all on 0.2.x so they share Symbol.for("@reflect-metadata:registry")).
  2. Declare the missing extensionDependencies if activation order is required.

Activity

  1. added
    triage-needed
    on Nov 29, 2026
  2. muldergj commented on Nov 30, 2026

    @muldergj

    Also reproduced on macOS (Apple Silicon): disabling the Azure extensions fixed it

    Environment

    • VS Code 1.148.0, macOS arm64
    • ms-python.python 2026.10.0
    • ms-python.vscode-python-envs 1.44.0
    • ms-toolsai.jupyter 2026.6.2026071501

    Symptoms: Missing required @injectable annotation. The Python extension failed to activate and the kernel picker did not list any Python environments.

    Fix: Disabling these extensions resolved it. The kernel was auto-detected and loaded, with no Missing required @... errors in the logs and with the original, unmodified extension manifests:

    • ms-toolsai.vscode-ai 1.4.2 (Azure Machine Learning)
    • ms-toolsai.vscode-ai-remote 1.6.0 (Azure Machine Learning - Remote)
    • ms-windows-ai-studio.windows-ai-studio 1.6.22 (Foundry Toolkit)

    All three declare reflect-metadata ^0.2.2. I did not test them one at a time, so I don't know which of them is responsible.

    Adding the extensionDependencies load-order workaround alone was not enough here: .venv appeared in the picker, but selecting it failed with the same error while creating the notebook controller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage-needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions