Skip to content

Soften diagnostic message for missing --environment flag - #5930

Merged
vhvb1989 merged 3 commits into
mainfrom
copilot/soften-diagnostic-message
Oct 17, 2025
Merged

Soften diagnostic message for missing --environment flag#5930
vhvb1989 merged 3 commits into
mainfrom
copilot/soften-diagnostic-message

Conversation

Copilot AI commented Oct 15, 2025

Copy link
Copy Markdown
Contributor

Problem

When running azd with the --debug flag, users would see a diagnostic message that appeared error-like:

'azd foo'command asked for envFlag, but envFlag was not included in cmd.Flags().

This message looked like an error even though it represents normal, safe behavior (falling back to the default environment).

Changes

Updated the diagnostic message in cli/azd/cmd/container.go (line 184) to be more informational and user-friendly:

Before:

log.Printf("'%s'command asked for envFlag, but envFlag was not included in cmd.Flags().", cmd.CommandPath())

After:

log.Printf("'%s' command did not include --environment so using default environment instead.", cmd.CommandPath())

The new message:

  • Adds the missing space after the command name
  • Uses clearer, more informative language
  • Explicitly indicates the fallback behavior (using default environment)
  • Makes it clear this is expected and safe to ignore

Testing

  • ✅ Code builds successfully
  • ✅ All unit tests pass
  • ✅ Code formatting and linting checks pass
  • ✅ No spelling errors

Fixes #4444 (if there's an associated issue number)

Original prompt

This section details on the original issue you should resolve

<issue_title>[Issue] Soften diagnostic message for missing --environment flag</issue_title>
<issue_description>Running azd with --debug will often show a trace like container.go:184: 'azd foo'command asked for envFlag, but envFlag was not included in cmd.Flags(). which looks like an error. We should change that message at https://github.com/Azure/azure-dev/blob/main/cli/azd/cmd/container.go#L184 to 'azd foo' command did not include --environment so using default environment instead so people know it's safe to ignore. Also make sure there's a space after the command name like the example there.</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #5929


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits October 15, 2025 17:36
Co-authored-by: tg-msft <1179329+tg-msft@users.noreply.github.com>
Co-authored-by: tg-msft <1179329+tg-msft@users.noreply.github.com>
Copilot AI changed the title [WIP] Soften diagnostic message for missing --environment flag Soften diagnostic message for missing --environment flag Oct 15, 2025
Copilot AI requested a review from tg-msft October 15, 2025 17:41
@rajeshkamal5050
rajeshkamal5050 marked this pull request as ready for review October 16, 2025 15:57
@vhvb1989

Copy link
Copy Markdown
Member

/check-enforcer override

@vhvb1989
vhvb1989 enabled auto-merge (squash) October 17, 2025 00:15
@vhvb1989
vhvb1989 merged commit 2e8aa18 into main Oct 17, 2025
11 of 12 checks passed
@JeffreyCA
JeffreyCA deleted the copilot/soften-diagnostic-message branch January 16, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Issue] Soften diagnostic message for missing --environment flag [Se] OKRs

4 participants