Skip to content

Clean up "no project" error message for agent operations#6716

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/improve-error-message
Draft

Clean up "no project" error message for agent operations#6716
Copilot wants to merge 5 commits intomainfrom
copilot/improve-error-message

Conversation

Copy link
Contributor

Copilot AI commented Feb 4, 2026

When attempting agent operations without an initialized project, users saw raw gRPC error details wrapped in multiple context layers:

Error: failed to add agent to azure.yaml: adding agent service to project: rpc error: code = Unknown desc = no project exists; to create a new project, run azd init

Changes

gRPC Service (internal/grpcserver/project_service.go)

  • Map azdcontext.ErrNoProject to codes.FailedPrecondition with clean message
  • Apply to Get() and AddService() methods via mapProjectError() helper

Extension (extensions/azure.ai.agents/internal/cmd/)

  • Detect FailedPrecondition status and return message directly
  • Preserve wrapping for other error types to maintain debug context

Tests (internal/grpcserver/project_service_test.go)

  • Verify status code and message format for no-project scenarios

Result

Error: No azd project found. Run 'azd init' to initialize your project.

Non-precondition errors retain their full context (e.g., failed to add agent to azure.yaml: failed to marshal agent config).

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • aka.ms
    • Triggering command: ./azd ./azd version --64 x_amd64/vet -I g/azdo/azdo.go g/azdo/build_pol-ifaceassert x_amd64/vet -pthread zd/pkg/ai -fmessage-length-bool x_amd64/vet -o 1.76.0/balancer/-errorsas om/pkg/browser@v-ifaceassert x_amd64/vet -p zd/pkg/sqldb -lang=go1.23 x_amd64/vet (dns block)
    • Triggering command: /home/REDACTED/work/azure-dev/azure-dev/cli/azd/azd /home/REDACTED/work/azure-dev/azure-dev/cli/azd/azd version --64 x_amd64/vet -qui�� _.a uthored-by: hemarina <104857065+hemarina@users.noreply.github.com> x_amd64/vet /tmp/go-build180/opt/hostedtoolcache/go/1.25.6/x64/pkg/tool/linux_amd64/vet zd/pkg/tools/bic-atomic x86_64-linux-gnu-bool x_amd64/vet -o 1.76.0/internal/-errorsas -trimpath x_amd64/vet -p g/grpc/encoding -lang=go1.25 x_amd64/vet (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Improve error message</issue_title>
<issue_description>If a developer hasn't initialized the project yet and they try to add an agent, they get this message:

Error: failed to add agent to azure.yaml: adding agent service to project: rpc error: code = Unknown desc = no project exists; to create a new project, run azd init

Could we tidy it up to say something like:

Error: No azd project found. Run 'azd init' to initialize your project before adding agents.

cc: @SophCarp @ccbarragan </issue_description>

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

@JeffreyCA "Error: failed to add agent to azure.yaml: adding agent service to project:" is part of the extension implementation and can be changed independently.

Maybe it makes sense to look into removing the "rpc error: code = Unknown desc =" part?</comment_new>
<comment_new>@kristenwomack
Yes, I think this makes sense to remove the "rpc error" because that exposes inner information that isn't as relevant to the end user of the extension.

cc: @@jfomhover

@vhvb1989 Should we start having one label per extension? Or is `ai` currently covering the agents extension?

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits February 4, 2026 22:31
…sions

Co-authored-by: hemarina <104857065+hemarina@users.noreply.github.com>
Co-authored-by: hemarina <104857065+hemarina@users.noreply.github.com>
…all site

Co-authored-by: hemarina <104857065+hemarina@users.noreply.github.com>
Co-authored-by: hemarina <104857065+hemarina@users.noreply.github.com>
Copilot AI changed the title [WIP] Update error message for adding agent Clean up "no project" error message for agent operations Feb 4, 2026
Copilot AI requested a review from hemarina February 4, 2026 22:41
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.

Improve error message

2 participants