Skip to content

Bug: Listing parameters when you have 0 panics, index out of bounds #491

Closed

Description

@Emyrk

Summary

When you do parameters list with 0 parameters, you get a panic.

$ ./coder parameters list
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/coder/coder/cli.parameterList.func1(0xc000259b80, {0xecfa7f0, 0x0, 0x0})
	/home/runner/work/coder/coder/cli/parameterlist.go:28 +0x6e5
github.com/spf13/cobra.(*Command).execute(0xc000259b80, {0xecfa7f0, 0x0, 0x0})
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:856 +0x60e
github.com/spf13/cobra.(*Command).ExecuteC(0xc00013ea00)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x3bc
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902
main.main()
	/home/runner/work/coder/coder/cmd/coder/main.go:10 +0x1e
steven ~/Downloads/example $                                         

Current Behavior (steps to reproduce)

A index out of bounds panic.

  1. Start a new dev server ./coder start --dev
  2. List params ./coder parameters list

Desired Behavior

Return an empty list

Activity

  1. code-asher commented on Mar 18, 2022

    @code-asher
    Member

    I got the same with coder ssh, I guess it might generally affect all the (or multiple) commands.

  2. added this to the V2 Alpha milestone on Mar 21, 2022
  3. modified the milestones: Community MVP, V2 Beta on May 4, 2022
  4. removed this from the Community MVP milestone on Jun 14, 2022
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

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions