`fastly service version validate` requires `--service-id` flag with no env var fallback

Open Beginner friendly
#1,866 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
go
Domain
cli

Research direction

Start at the implementation of fastly service version validate and compare how it resolves --service-id with other service commands that accept FASTLY_SERVICE_ID. Reproduce the command using only the environment variable, then add or update coverage for that invocation. Done means validation succeeds without explicitly passing --service-id when the environment variable is set.

Written by the indexing model from the issue text.

Description

bug

Version

Fastly CLI version v15.4.0 (c142c746)
Built with go version go1.26.4 darwin/arm64 (2026-07-30)

What happened

When running fastly service version validate, the command errors and requires the --service-id flag to be set. The FASTLY_SERVICE_ID environment variable is present and is successfully used with other commands in the same session.

Steps:

  1. Exported the Fastly API credentials as environment variables for the shell session:
export FASTLY_SERVICE_ID="" # Provided ID
export FASTLY_API_TOKEN="" # Provided token
  1. Verified API credentials were valid and returning information:
fastly whoami
  1. Drafted some service changes, all reporting successful
# Clone a new service version for adding a dynamic ACL
fastly service acl create --version="active" --name="restricted_ips" --autoclone

# Add a `recv` type VCL snippet that will use the ACL entries to enforce some client IP restrictions
fastly service vcl snippet create --version="latest" --name="custom_restricted-ips_recv" --type="recv" --content="./restricted-ips.vcl" --priority=5
  1. Tried to validate the draft version before publishing
fastly service version validate --version="latest"
  1. Received error:

ERROR: error parsing arguments: required flag --service-id not provided.

  1. Retried by explicitly passing the --service-id flag equal to the environment variable, which was successful
fastly service version validate --version="latest" --service-id="${FASTLY_SERVICE_ID}"
# SUCCESS: Service ... version 18 is valid: Warning: Unused table `enabled_products`
Dominant language
Go
Stars
164
Forks
80
Avg merge
14h 22m
Merged PRs (30d)
17

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fastly/cli

All issues in fastly/cli

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.