Skip to content

Port-forward command fails with multiple agents instead of defaulting to primary agent #21223

@bjornrobertsson

Description

@bjornrobertsson

Problem

The coder port-forward CLI command throws an error when multiple agents are present in a workspace, rather than defaulting to the most common primary agents (main/dev).

Encountered an error running "coder port-forward", see "coder port-forward --help" for more information
error: multiple agents found, please specify the agent name, available agents: [custom-agent main]

Proposed Resolution

Primary: Update the usage examples in cli/portforward.go to clarify agent specification and reduce confusion.

Update usage from:

coder port-forward [flags] <workspace>

to:

coder port-forward [flags] <workspace>[.agent]

Alternative: Print a helpful message and assume main/dev as the intended endpoint when multiple agents exist.

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