Skip to content

VS Code tasks fail with error "Cannot read properties of undefined (reading 'shell')" #56

Closed

Description

@apgrucza

When the extension is enabled, tasks defined in .vscode/tasks.json fail to run. For example:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "echo",
            "type": "shell",
            "command": "echo Hello"
        }
    ]
}

When using the Tasks: Run Task command and selecting the echo task, this error pops up:

Cannot read properties of undefined (reading 'shell')
  • Task version: 3.24.0
  • Operating System: Windows

Activity

  1. changed the title [-]VS Code tasks (fail with [/-] [+]VS Code tasks fail with error "Cannot read properties of undefined (reading 'shell')"[/+] on May 21, 2023
  2. ilkka commented on Sep 11, 2023

    @ilkka

    Broken in the same way for me as well, on Linux, with the latest snap version of vs code.

  3. shalauko commented on Nov 17, 2023

    @shalauko

    Same for me on native Windows 10 and in WSL2 (Ubuntu 22.04).
    Is there some workaround available?

  4. polamjag commented on Jan 5, 2024

    @polamjag

    Same for me on native macOS (14.2.1 (23C71)) and VS Code 1.85.1 (Universal).

  5. siberianbot commented on May 17, 2024

    @siberianbot

    Hi! Are there any updates on this?

  6. 3uclid3 commented on Jun 9, 2024

    @3uclid3

    I'm using 'code workspace' with multiple project in it. (multiple taskfiles)

    I have more than 1 default build task.
    If I'm being ask by vscode to choose, it fails with the error.
    If I remove the other tasks and don't have to choose, it work fine.

  7. MrVermond commented on Jun 13, 2024

    @MrVermond

    Same here.
    So the extension just breaks the vscode tasks feature and is therefore not usable.

  8. ssbarnea commented on Jun 27, 2024

    @ssbarnea

    @pd93 Apparently vscode-task extension does break native vscode ability to run tasks (unrelated to taskfile). See them documented at https://code.visualstudio.com/docs/editor/tasks#vscode

    When this extension is installed we can see the error described by the OP.

  9. added theissue type on Aug 21, 2025
  10. pd93 commented on Sep 11, 2025

    @pd93
    Member

    Update for all of you very patient people. I've taken a look at this issue several times over the last couple of years since it was opened and I've had a variety of emotions ranging from confusion to anger as I have tried to work out what the issue was. Today I have finally worked it out - and its just as annoying as you might think.

    I was fed up with trying to work out what was logically wrong with the extension and instead decided to brute force the problem by slowly removing parts of the extension until the issue went away. Once I found the section that resolved the issue when removed, I created a brand new extension using the Yo generator tool and tried to reproduce the issue. You can see this reproduction here.

    To summarise. VSCode extensions have a dedicated "contributes" section of the package.json which defines a variety of things such as commands, views and configuration. In the Task extension, we define our configuration here under the "task" key (so you end up with setting like "task.path": "/path/to/task"). For whatever reason, using this specific key name completely breaks the built-in VSCode tasks feature. I have absolutely no idea why.

    To proceed we can:

    1. Either accept this quirk of VSCode and put all of our configuration under a new key, such as "go-task" or "taskfile" and accept that anyone with existing configuration will need to migrate it.
    2. Raise an issue on the VSCode repository itself to find out if this behavior is intended and what the actual issue is.
    • If intended, we ask them to provide better documentation to stop this happening again and see point 1.
    • If not intended, we ask them to fix the issue.

    Option 2 may take much longer and not result in a solution. However, it will not break users config and we get to keep our settings namespace. I wanted to gather some thoughts here before raising a ticket on the VSCode project.

  11. andreynering commented on Sep 11, 2025

    @andreynering
    Member

    @pd93 I suggest openning an issue to see if they respond in reasonable time. If they don't respond in a few days or weeks, we can move the setting namespace.

  12. pd93 commented on Sep 11, 2025

    @pd93
    Member

    I suggest openning an issue

    microsoft/vscode-discussions#2827

  13. pd93 commented on Sep 19, 2025

    @pd93
    Member

    Another update for those following along. I have fixed this issue by renaming the configuration namespace for Task from task to taskfile. This will be included in the next release and the extension will prompt you to change your settings when it updates (see below). Changing your settings today will have no effect so please wait until you see the prompt.

    Image

    Please note that the next extension release will require Task to be on v3.45.3+. This version of Task was only released a few days ago and so we will be waiting a little bit longer before releasing the next version of the extension in order to reduce disruption.

    I may publish a pre-release version in the coming weeks for those who want to test out the new version and are willing to manually install via a .vsix file.

    Since this is a breaking change, the next full release will be v1.0.0.

  14. iamkarlson commented on Jan 5, 2026

    @iamkarlson

    Hi @pd93
    Have you published it? I just stumbled upon this error too

  15. pd93 commented on Feb 14, 2026

    @pd93
    Member

    @iamkarlson v1.0.0 is now released.

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

    No labels
    No labels

    Type

    Fields

    No fields configured for bug.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions