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
@nadzeyav

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

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