Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

obtuse and confusing error with local feature under WSL #834

Closed
dotysan opened this issue Jun 1, 2024 · 4 comments
Closed

obtuse and confusing error with local feature under WSL #834

dotysan opened this issue Jun 1, 2024 · 4 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@dotysan
Copy link

dotysan commented Jun 1, 2024

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!

@samruddhikhandale
Copy link
Member

samruddhikhandale commented Jun 3, 2024

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."

@dotysan
Copy link
Author

dotysan commented Jun 4, 2024

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!

@samruddhikhandale
Copy link
Member

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

@prathameshzarkar9 prathameshzarkar9 self-assigned this Jun 5, 2024
@prathameshzarkar9
Copy link
Contributor

Hi @samruddhikhandale ,

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

chrmarti pushed a commit that referenced this issue Jun 13, 2024
* obtuse and confusing error with local feature under WSL #834

* addressed review comments and modified error message accordingly

* review comments addressed and error message changed as needed

* error message tab removed and variable moved to if condition
@chrmarti chrmarti added the bug Something isn't working label Jun 13, 2024
@chrmarti chrmarti added this to the June 2024 milestone Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants