Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0) #28322

Closed
samhodgkinson opened this issue Feb 7, 2024 · 17 comments
Closed
Labels
Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. DevOps Service Attention This issue is responsible by Azure service team. Similar-Issue

Comments

@samhodgkinson
Copy link

Describe the bug

When using Azure CLI work with what seems to be JSON object from multiple commands I'm getting, the below errors today, this work fine the day before.

Related command

Az datadog monitor create

az repos pr create

Errors

ERROR: The command failed with an unexpected error. Here is the traceback:
ERROR: Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)
Traceback (most recent call last):
File "/opt/az/lib/python3.11/site-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/json/init.py", line 335, in loads
raise JSONDecodeError("Unexpected UTF-8 BOM (decode using utf-8-sig)",
json.decoder.JSONDecodeError: Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/az/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 588, in execute
parsed_args = self.parser.parse_args(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/knack/parser.py", line 261, in parse_args
return super().parse_args(args)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/argparse.py", line 1869, in parse_args
args, argv = self.parse_known_args(args, namespace)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/cli/core/parser.py", line 281, in parse_known_args
self._namespace, self._raw_arguments = super().parse_known_args(args=args, namespace=namespace)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/argparse.py", line 1902, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/argparse.py", line 2096, in _parse_known_args
positionals_end_index = consume_positionals(start_index)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/argparse.py", line 2073, in consume_positionals
take_action(action, args)
File "/opt/az/lib/python3.11/argparse.py", line 1962, in take_action
argument_values = self._get_values(action, argument_strings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/cli/core/parser.py", line 272, in _get_values
value = super(AzCliCommandParser, self)._get_values(action, arg_strings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/argparse.py", line 2506, in _get_values
self._check_value(action, value[0])
File "/opt/az/lib/python3.11/site-packages/azure/cli/core/parser.py", line 300, in _check_value
use_dynamic_install = try_install_extension(self, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/cli/core/extension/dynamic_install.py", line 119, in try_install_extension

Issue script & Debug output

We seem to be seeing UTF-8 BOM which seems to be affect actions performed on json

Expected behavior

To deploy data dog ISV
To create an AZO pull / approve ...etc

Environment Summary

Azure DevOps CLI extension for Azure CLI 1.0.0 Latest

Additional context

No response

@samhodgkinson samhodgkinson added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Feb 7, 2024
Copy link

Hi @samhodgkinson
Find similar issue #28321.

Issue title Installation of extension(s) is not working due to parsing error of extensionCommandTree.json
Create time 2024-02-07
Comment number 0

Please confirm if this resolves your issue.

@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot Service Attention This issue is responsible by Azure service team. DevOps labels Feb 7, 2024
@yonzhan
Copy link
Collaborator

yonzhan commented Feb 7, 2024

Thank you for opening this issue, we will look into it.

Copy link
Contributor

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @v-anvashist, @V-hmusukula.

@samhodgkinson
Copy link
Author

Hi @samhodgkinson Find similar issue #28321.

Issue title Installation of extension(s) is not working due to parsing error of extensionCommandTree.json
Create time 2024-02-07
Comment number 0
Please confirm if this resolves your issue.

This look similar but does not fix my issue

@mdrakiburrahman
Copy link

All our automation pipelines are all blocked. This is a new regression caused last night in Azure CLI, things were working fine last night for the same pipeline:

image

@DeV1L
Copy link

DeV1L commented Feb 7, 2024

The same issue with az ssh vm --ip ...

ERROR: The command failed with an unexpected error. Here is the traceback:
ERROR: Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)
Traceback (most recent call last):
  File "/opt/az/lib/python3.11/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/json/__init__.py", line 335, in loads
    raise JSONDecodeError("Unexpected UTF-8 BOM (decode using utf-8-sig)",
json.decoder.JSONDecodeError: Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/opt/az/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 588, in execute
    parsed_args = self.parser.parse_args(args)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/knack/parser.py", line 261, in parse_args
    return super().parse_args(args)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/argparse.py", line 1869, in parse_args
    args, argv = self.parse_known_args(args, namespace)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/parser.py", line 281, in parse_known_args
    self._namespace, self._raw_arguments = super().parse_known_args(args=args, namespace=namespace)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/argparse.py", line 1902, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/argparse.py", line 2096, in _parse_known_args
    positionals_end_index = consume_positionals(start_index)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/argparse.py", line 2073, in consume_positionals
    take_action(action, args)
  File "/opt/az/lib/python3.11/argparse.py", line 1962, in take_action
    argument_values = self._get_values(action, argument_strings)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/parser.py", line 272, in _get_values
    value = super(AzCliCommandParser, self)._get_values(action, arg_strings)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/argparse.py", line 2506, in _get_values
    self._check_value(action, value[0])
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/parser.py", line 300, in _check_value
    use_dynamic_install = try_install_extension(self, args)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/extension/dynamic_install.py", line 119, in try_install_extension
    _check_value_in_extensions(cli_ctx, parser, args, use_dynamic_install == 'yes_without_prompt')
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/extension/dynamic_install.py", line 150, in _check_value_in_extensions
    ext_name = _search_in_extension_commands(cli_ctx, command_str, allow_prefix_match=allow_prefix_match)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/extension/dynamic_install.py", line 87, in _search_in_extension_commands
    cmd_chain = _get_extension_command_tree(cli_ctx)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/extension/dynamic_install.py", line 38, in _get_extension_command_tree
    EXT_CMD_TREE.data = response.json()
                        ^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

@LandryDubus
Copy link

LandryDubus commented Feb 7, 2024

We got the same issue starting today too when using az config set extension.use_dynamic_install=yes_without_prompt:

': exit status 1. Output: y", line 300, in _check_value
    use_dynamic_install = try_install_extension(self, args)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/extension/dynamic_install.py", line 119, in try_install_extension
    _check_value_in_extensions(cli_ctx, parser, args, use_dynamic_install == 'yes_without_prompt')
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/extension/dynamic_install.py", line 150, in _check_value_in_extensions
    ext_name = _search_in_extension_commands(cli_ctx, command_str, allow_prefix_match=allow_prefix_match)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/extension/dynamic_install.py", line 87, in _search_in_extension_commands
    cmd_chain = _get_extension_command_tree(cli_ctx)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/extension/dynamic_install.py", line 38, in _get_extension_command_tree
    EXT_CMD_TREE.data = response.json()
                        ^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Unexpected UTF-8 BOM (decode using
utf-8-sig): line 1 column 1 (char 0)
To check existing issues, please visit:
https://github.com/Azure/azure-cli/issues
ERROR: The command failed with an unexpected error. Here is the traceback:
ERROR: Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char
0)
Traceback (most recent call last):
  File "/opt/az/lib/python3.11/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/json/__init__.py", line 335, in loads
    raise JSONDecodeError("Unexpected UTF-8 BOM (decode using utf-8-sig)",
json.decoder.JSONDecodeError: Unexpected UTF-8 BOM (decode using
utf-8-sig): line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/az/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 588, in execute
    parsed_args = self.parser.parse_args(args)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/knack/parser.py", line 261, in parse_args
    return super().parse_args(args)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/argparse.py", line 1869, in parse_args
    args, argv = self.parse_known_args(args, namespace)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/parser.py", line 281, in parse_known_args
    self._namespace, self._raw_arguments = super().parse_known_args(args=args, namespace=namespace)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/argparse.py", line 1902, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/argparse.py", line 2096, in _parse_known_args
    positionals_end_index = consume_positionals(start_index)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/argparse.py", line 2073, in consume_positionals
    take_action(action, args)
  File "/opt/az/lib/python3.11/argparse.py", line 1978, in take_action
    action(self, namespace, argument_values, option_string)
  File "/opt/az/lib/python3.11/argparse.py", line 1241, in __call__
    subnamespace, arg_strings = parser.parse_known_args(arg_strings, None)
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/parser.py", line 281, in parse_known_args
    self._namespace, self._raw_arguments = super().parse_known_args(args=args, namespace=namespace)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/argparse.py", line 1902, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/argparse.py", line 2096, in _parse_known_args
    positionals_end_index = consume_positionals(start_index)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/argparse.py", line 2073, in consume_positionals
    take_action(action, args)
  File "/opt/az/lib/python3.11/argparse.py", line 1978, in take_action
    action(self, namespace, argument_values, option_string)
  File "/opt/az/lib/python3.11/argparse.py", line 1241, in __call__
    subnamespace, arg_strings = parser.parse_known_args(arg_strings, None)
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/parser.py", line 281, in parse_known_args
    self._namespace, self._raw_arguments = super().parse_known_args(args=args, namespace=namespace)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/argparse.py", line 1902, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/argparse.py", line 2096, in _parse_known_args
    positionals_end_index = consume_positionals(start_index)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/argparse.py", line 2073, in consume_positionals
    take_action(action, args)
  File "/opt/az/lib/python3.11/argparse.py", line 1962, in take_action
    argument_values = self._get_values(action, argument_strings)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/parser.py", line 272, in _get_values
    value = super(AzCliCommandParser, self)._get_values(action, arg_strings)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/argparse.py", line 2506, in _get_values
    self._check_value(action, value[0])
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/parser.py", line 300, in _check_value
    use_dynamic_install = try_install_extension(self, args)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/extension/dynamic_install.py", line 119, in try_install_extension
    _check_value_in_extensions(cli_ctx, parser, args, use_dynamic_install == 'yes_without_prompt')
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/extension/dynamic_install.py", line 150, in _check_value_in_extensions
    ext_name = _search_in_extension_commands(cli_ctx, command_str, allow_prefix_match=allow_prefix_match)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/extension/dynamic_install.py", line 87, in _search_in_extension_commands
    cmd_chain = _get_extension_command_tree(cli_ctx)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/extension/dynamic_install.py", line 38, in _get_extension_command_tree
    EXT_CMD_TREE.data = response.json()
                        ^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Unexpected UTF-8 BOM (decode using
utf-8-sig): line 1 column 1 (char 0)
To check existing issues, please visit:
https://github.com/Azure/azure-cli/issues

@ranat5
Copy link

ranat5 commented Feb 7, 2024

We are also having a similar issue in our automated pipelines with the command (az-cli version 2.52,53,57):
az graph query -q ...
image

@SAday-WASR
Copy link

Same issue here, using az functionapp config appsettings set

@kabasm
Copy link

kabasm commented Feb 7, 2024

Same issue here, using az monitor app-insights component create

@grixxie
Copy link

grixxie commented Feb 7, 2024

same issue here using az monitor app-insights component show, started seeing this 1-2 hours ago today

@malsey
Copy link

malsey commented Feb 7, 2024

same issue using az config set extension.use_dynamic_install=yes_without_prompt --only-show-errors

@arasdk
Copy link

arasdk commented Feb 7, 2024

Same issue here using az datafactory pipeline-run query-by-factory --factory-name "name" --resource-group "rg" --output json | ConvertFrom-Json -Depth 100

@virgilp
Copy link

virgilp commented Feb 7, 2024

Same issues with az account help - pretty much everything

@jiasli
Copy link
Member

jiasli commented Feb 7, 2024

Duplicate of #28321

@jiasli jiasli marked this as a duplicate of #28321 Feb 7, 2024
@jiasli jiasli closed this as completed Feb 7, 2024
@yonzhan
Copy link
Collaborator

yonzhan commented Feb 7, 2024

We are looking into this and will follow up in #28321

@MikeLanglois
Copy link

Having the same issue with our pipeline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. DevOps Service Attention This issue is responsible by Azure service team. Similar-Issue
Projects
None yet
Development

No branches or pull requests