Skip to content

CLI: getting "Validation failed name: username" error in cli in case workspace or template name does not follow allowed pattern #1673

Closed

Description

@nadzeyav

OS Information

  • OS: Windows 10
  • coder --version:
    Coder v0.5.10+ba818b3 Wed May 18 00:07:20 UTC 2022
    ba818b3

Steps to Reproduce

  1. Init any template
  2. Run "coder template create wrong-name_ -d "[path to template]"
  3. Set service account key
  4. Confirm create? (yes/no) yes

Expected

Any error message that template name has a wrong format is displayed

Actual

status code 400: Validation failed
name: username

The same for a new worskpace created with CLI.

What is your suggestion?

Currently if Workspace Name or Template Name does not match names rules: "Name must start with a-Z or 0-9 and can contain a-Z, 0-9 or -."
in CLI the resulting error is:

status code 400: Validation failed
name: username

That is confusing since this is not username that causes the error, but template name or workspace name in case workspace was created.

Logs

Screenshot

Template error

image

Workspace error

image

Notes

Activity

  1. changed the title [-]Bug: CLI: getting "Validation failed name: username" error in cli in case workspace or template name does not follow allowed pattern[/-] [+]CLI: getting "Validation failed name: username" error in cli in case workspace or template name does not follow allowed pattern[/+] on Jun 7, 2022
  2. github-actions commented on Aug 7, 2022

    @github-actions
    Contributor

    This issue is becoming stale. In order to keep the tracker readable and actionable, I'm going close to this issue in 7 days if there isn't more activity.

  3. mafredri commented on Aug 8, 2022

    @mafredri
    Member

    This issue will be fixed by #3390, once merged, the output will look like this:

    > Confirm create? (yes/no)
    Validation failed.
    - name: Validation failed for tag "template_name" with value: "wrong-name_"
    Run 'coder templates create --help' for usage.
    
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

    apiArea: HTTP API

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions