Skip to content

railway scale misclassifies the long --project option as a region assignment #1024

Description

@jaaortega

Railway CLI version

5.28.1

What happened

I hit this while scripting a scale change with explicit project, environment, and service selectors:

railway scale \
  --project <PROJECT_ID> \
  --environment <ENVIRONMENT> \
  --service <SERVICE_ID> \
  us-west=0 \
  --json

The command fails with:

Invalid replica count `<PROJECT_ID>` in `project=<PROJECT_ID>`

Caused by:
invalid digit found in string

Using the short project option works:

railway scale \
  -p <PROJECT_ID> \
  -e <ENVIRONMENT> \
  -s <SERVICE_ID> \
  us-west=0 \
  --json

Expected behavior

--project <PROJECT_ID> should behave the same as -p <PROJECT_ID>.

Possible cause

I took a quick look at src/commands/scale.rs. The legacy scale argument normalizer recognizes service and environment as long options that take values, but not project:

cli/src/commands/scale.rs

Lines 383 to 389 in 4d49d98

fn scale_long_flag_takes_value(flag: &str) -> bool {
matches!(flag, "service" | "environment")
}
fn scale_long_flag_is_known(flag: &str) -> bool {
matches!(flag, "json" | "help" | "version") || scale_long_flag_takes_value(flag)
}

That appears to cause --project <ID> to be normalized into the positional assignment project=<ID> before Clap parses it.

--project was added to scale in #893, shortly after the scale argument normalizer was introduced in #881.

The current workaround is to use -p.

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