From 39022139ae2ae5a44a41496d5db20069655aae34 Mon Sep 17 00:00:00 2001 From: jennypng <63012604+JennyPng@users.noreply.github.com> Date: Mon, 18 May 2026 14:32:06 -0700 Subject: [PATCH 1/2] output doc link for 401 error --- .../eng/scripts/setup/package_manager.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/http-client-python/eng/scripts/setup/package_manager.py b/packages/http-client-python/eng/scripts/setup/package_manager.py index 3b6698279d9..5725bddab35 100644 --- a/packages/http-client-python/eng/scripts/setup/package_manager.py +++ b/packages/http-client-python/eng/scripts/setup/package_manager.py @@ -100,10 +100,20 @@ def install_packages(packages: list, venv_context=None, package_manager: str = N try: if cwd: - subprocess.check_call(install_cmd + packages, cwd=cwd) + result = subprocess.run(install_cmd + packages, cwd=cwd, capture_output=True, text=True) else: - subprocess.check_call(install_cmd + packages) - except subprocess.CalledProcessError as e: + result = subprocess.run(install_cmd + packages, capture_output=True, text=True) + if result.returncode != 0: + error_output = (result.stderr or "") + (result.stdout or "") + error_msg = f"Failed to install packages with {package_manager}: command exited with code {result.returncode}\n{error_output}" + if "401" in error_output or "Unauthorized" in error_output: + error_msg += ( + "\n\nReceived a 401 Unauthorized error from the Azure feed. " + "A pip dependency may not yet be cached. To fix this, follow the authentication steps at: " + "https://github.com/Azure/azure-sdk-for-python/blob/main/CONTRIBUTING.md#authentication-for-upstream-pull-through" + ) + raise RuntimeError(error_msg) + except OSError as e: raise RuntimeError(f"Failed to install packages with {package_manager}: {e}") From 62fb7bb5809d5f7b1969329403431c8ec73a3042 Mon Sep 17 00:00:00 2001 From: jennypng <63012604+JennyPng@users.noreply.github.com> Date: Mon, 18 May 2026 15:08:45 -0700 Subject: [PATCH 2/2] chronus --- .chronus/changes/cfs-error-message-2026-4-18-15-8-34.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .chronus/changes/cfs-error-message-2026-4-18-15-8-34.md diff --git a/.chronus/changes/cfs-error-message-2026-4-18-15-8-34.md b/.chronus/changes/cfs-error-message-2026-4-18-15-8-34.md new file mode 100644 index 00000000000..80cc0766129 --- /dev/null +++ b/.chronus/changes/cfs-error-message-2026-4-18-15-8-34.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@typespec/http-client-python" +--- + +When python emitter install fails due to 401 error, output informative instructions linking to resolution steps in the Python SDK's repo docs. \ No newline at end of file