Skip to content

obtuse and confusing error with local feature under WSL #834

Closed

Description

@dotysan

My mistake was putting "myfeature" inside devcontainer.json instead of "./myfeature". However the error message was horribly misleading.

To reproduce, create .devcontainer/myfeature/devcontainer-feature.json and add this to .devcontainer/devcontainer.json:

"features": { "myfeature": {} }

You will get this error:

[1013 ms] @devcontainers/cli 0.59.1. Node.js v18.18.2. linux 5.15.146.1-microsoft-standard-WSL2 x64.
[1013 ms] Start: Run: docker buildx version
[1072 ms] github.com/docker/buildx v0.14.0-desktop.1 7b0470cffd54ccbf42976d2f75febc4532c85073
[1072 ms] 
[1072 ms] Start: Run: docker -v
[1100 ms] Start: Resolving Remote
[1103 ms] Start: Run: git rev-parse --show-cdup
[1347 ms] Start: Run: docker ps -q -a --filter label=devcontainer.local_folder=\\wsl.localhost\Ubuntu\home\curtis\src\mydevcon --filter label=devcontainer.config_file=/home/curtis/src/mydevcon/.devcontainer/devcontainer.json
[1387 ms] Start: Run: docker inspect --type image ubuntu:24.04
[1426 ms] Resolving Feature dependencies for 'myfeature'...
[1426 ms] * Processing feature: myfeature
[1426 ms] Legacy feature 'myfeature' not supported. Please check https://containers.dev/features for replacements.
[1422 ms] Error: Legacy feature 'myfeature' not supported. Please check https://containers.dev/features for replacements.
...
[1428 ms] Exit code 1

After changing .devcontainer/devcontainer.json:

"features": { "./myfeature": {} }

The error is gone:

[884 ms] @devcontainers/cli 0.59.1. Node.js v18.18.2. linux 5.15.146.1-microsoft-standard-WSL2 x64.
[884 ms] Start: Run: docker buildx version
[941 ms] github.com/docker/buildx v0.14.0-desktop.1 7b0470cffd54ccbf42976d2f75febc4532c85073
[941 ms] 
[941 ms] Start: Run: docker -v
[968 ms] Start: Resolving Remote
[971 ms] Start: Run: git rev-parse --show-cdup
[975 ms] Start: Run: docker ps -q -a --filter label=devcontainer.local_folder=\\wsl.localhost\Ubuntu\home\curtis\src\mydevcon --filter label=devcontainer.config_file=/home/curtis/src/mydevcon/.devcontainer/devcontainer.json
[1013 ms] Start: Run: docker inspect --type container 1323df1e4d14
[1054 ms] Start: Removing Existing Container
[1054 ms] Start: Run: docker rm -f 1323df1e4d1482cdd184d9ac503c3179a880cb05372474405c8f7527d25557aa
[1113 ms] Start: Run: docker inspect --type image ubuntu:24.04
[1156 ms] Resolving Feature dependencies for './myfeature'...
[1156 ms] * Processing feature: ./myfeature
[1156 ms] Local disk feature.

Can we fix https://github.com/devcontainers/cli/blob/main/src/spec-configuration/containerFeaturesConfiguration.ts#L700 so the next poor schmuck that makes the same mistake I did doesn't waste hours tracking this down?

A simple "you forgot to prepend './' to your feature" would have really helped.

Or better yet, allow the WSL syntax with relative subdir without the leading './' would be nice!

Activity

  1. samruddhikhandale commented on Jun 3, 2024

    @samruddhikhandale
    Member

    Hi 👋

    "features": { "myfeature": {} }

    ^ was an older and deprecated approach for using Feature (even before the concept of dev container Features). Hence, the error message seems correct given the prior context.

    However, I can understand how this might be confusing to you. Apologies for the inconvenience!

    We can update the error message as 👇 Let us know if that will be helpful, thanks

    Legacy feature '${userFeatureId}' not supported. Please check https://containers.dev/features for replacements. \n
    If you were hoping to use local Features, remember to prepend your Feature name with "./". Please check https://containers.dev/implementors/features-distribution/#addendum-locally-referenced for more information."
    
  2. dotysan commented on Jun 4, 2024

    @dotysan
    Author
    Legacy feature '${userFeatureId}' not supported. Please check https://containers.dev/features for replacements. \n
    If you were hoping to use local Features, remember to prepend your Feature name with "./". Please check https://containers.dev/implementors/features-distribution/#addendum-locally-referenced for more information."
    

    Yes, I presumed there was some history in that code. And that error message looks great!

  3. samruddhikhandale commented on Jun 4, 2024

    @samruddhikhandale
    Member

    Prathamesh Zarkar (@prathameshzarkar9) / Gaurav Saini (@gauravsaini04) Can either of you pick this up next? All it needs is an update to the logging & error message. See #834 (comment)

  4. prathameshzarkar9 commented on Jun 5, 2024

    @prathameshzarkar9
    Contributor

    Hi Samruddhi Khandale (@samruddhikhandale) ,

    I have created a PR for this fix. Modified the confusing error message displayed to the user as recommended.
    #838

  5. added
    bug
    on Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions