Every week, not all the time, I am getting this error in the my Powershell ps1 logs This is a Windows Server A few people have ps1 programs in this server They may be using other service accounts
The error is shown below. See --stderr snippet-- The reason is something is saying a line on the config_fp file. This is a duplicate line. Once I delete the line in a text editor, the error does not happen again config_fp is used by my colleague. Mine is config_cag. The content is the same. We created different configurations in an attempt to solve this problem. See
--config_fp--
--config_cag--
Any idea why the duplicate line is created? How do I stop this error? Something is triggering this because it does not happen all the time. See code snippet here. It is just
- activating the configuration
- setting the account See
--code snippet--
This is the stderr snippet:
--stderr snippet--
ERROR: gcloud failed to load. This usually indicates corruption in your gcloud installation or problems with your Python interpreter.
Please verify that the following is the path to a working Python 3.8-3.13 executable: C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\python.exe
If it is not, please set the CLOUDSDK_PYTHON environment variable to point to a working Python executable.
If you are still experiencing problems, please reinstall the Google Cloud CLI using the instructions here: https://cloud.google.com/sdk/docs/install
Traceback (most recent call last): File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\gcloud.py", line 110, in gcloud_exception_handler yield File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\gcloud.py", line 187, in main gcloud_main = _import_gcloud_main() ^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\gcloud.py", line 90, in _import_gcloud_main import googlecloudsdk.gcloud_main File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\gcloud_main.py", line 34, in from googlecloudsdk.calliope import base File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\base.py", line 30, in from googlecloudsdk.calliope import arg_parsers File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\arg_parsers.py", line 64, in from googlecloudsdk.core import log File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\log.py", line 849, in _log_manager = _LogManager() ^^^^^^^^^^^^^ File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\log.py", line 584, in init self.Reset(sys.stdout, sys.stderr) File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\log.py", line 597, in Reset std_console_formatter = _ConsoleFormatter(stderr) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\log.py", line 371, in init console_log_format = properties.VALUES.core.console_log_format.Get() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\properties.py", line 4162, in Get property_value = self.GetPropertyValue(required, validate) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\properties.py", line 4182, in GetPropertyValue named_configs.ActivePropertiesFile.Load(), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\configurations\named_configs.py", line 447, in Load ActivePropertiesFile._PROPERTIES = properties_file.PropertiesFile( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\configurations\properties_file.py", line 52, in init self.__Load(properties_path) File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\configurations\properties_file.py", line 64, in __Load parsed_config.read(properties_path) File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\Lib\configparser.py", line 684, in read self._read(fp, filename) File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\Lib\configparser.py", line 1075, in _read raise DuplicateOptionError(sectname, optname, configparser.DuplicateOptionError: While reading from 'C:\Users\appladmin\AppData\Roaming\gcloud\configurations\config_fp' [line 5]: option 'project' in section 'core' already exists
This is the the PS1 code snippet:
--code snippet--
#... code not related to gcloud ...
#Activate CAG
gcloud config configurations activate $cag
gcloud config set account $gcsaccount
#gcloud auth activate-service-account $gcsaccount --key-file $credentialPath --project=$gcsproject
#... code not related to gcloud ...
gcloud storage ls --recursive $DestinationDir
#De-Activate CAG
gcloud config configurations activate fp
$this.logging.LogMessage( "GCS Rsync completed::"+$SourceDir+"::"+$DestinationDir , "Info")
$this.logging.LogMessage( "End of class - GcsCopy - method - Rsync" , "Info")
} catch {
echo $_.Exception.GetType().FullName,$_.Exception.Message
$this.logging.LogMessage( "Exception - Rsync - method - Rsync" , "Error")
$this.logging.LogMessage( $_.Exception.GetType().FullName+"::"+$_.Exception.Message , "Error")
}
These are the Gcloud SDK configuration files found inside C:\Users\appladmin\AppData\Roaming\gcloud\configurations Notice that in one config file the project line has been duplicated.
--config_fp--
[core] account = posteam-data-upload@ne-fprt-data-cloud-production.iam.gserviceaccount.com project = ne-fprt-data-cloud-production
project = ne-fprt-data-cloud-production
--config_cag--
[core] account = posteam-data-upload@ne-fprt-data-cloud-production.iam.gserviceaccount.com project = ne-fprt-data-cloud-production