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

[Az 0.6.1] Start-AzAutomationRunbook ends with a JSON conversion error #7977

Open
alexandair opened this issue Dec 1, 2018 · 16 comments
Open
Assignees
Labels
Automation Service Attention This issue is responsible by Azure service team.

Comments

@alexandair
Copy link
Contributor

Every time I start a runbook using the Start-AzAutomationRunbook, job completes as expected, but I get an error:

Start-AzAutomationRunbook : Conversion from JSON failed with error: Unexpected character encountered while parsing value: S. Path '', line 0, position 0.
@cormacpayne
Copy link
Member

@alexandair Hey Aleksandar, would you mind providing the following information:

  • the debug trace from executing the command with $DebugPreference = "Continue"
  • the full error output from running Resolve-AzError

@alexandair
Copy link
Contributor Author

Start-AzAutomationRunbook : Conversion from JSON failed with error: Unexpected character encountered while parsing value: S. Path '', line 0, position 0.
At line:1 char:1
+ Start-AzAutomationRunbook @startParams -Wait -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : CloseError: (:) [Start-AzAutomationRunbook], CmdletInvocationException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Automation.Cmdlet.StartAzureAutomationRunbook

DEBUG: AzureQoSEvent: CommandName - Start-AzAutomationRunbook; IsSuccess - False; Duration - 00:01:00.6955491; Exception - System.Management.Automation.CmdletInvocationException: Conversion from JSON failed with error: Unexpected character encountered while parsing value: S. Path '', line 0, position 0. ---> System.ArgumentException: Conversion from JSON failed with error: Unexpected character encountered while parsing value: S. Path '', line 0, position 0. ---> Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: S. Path '', line 0, position 0.
   at Newtonsoft.Json.JsonTextReader.ParseValue()
   at Newtonsoft.Json.JsonTextReader.Read()
   at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, JsonSerializerSettings settings)
   at Microsoft.PowerShell.Commands.JsonObject.ConvertFromJson(String input, Boolean returnHashtable, ErrorRecord& error)
   --- End of inner exception stack trace ---
   at Microsoft.PowerShell.Commands.JsonObject.ConvertFromJson(String input, Boolean returnHashtable, ErrorRecord& error)
   at Microsoft.PowerShell.Commands.ConvertFromJsonCommand.ConvertFromJsonHelper(String input)
   at Microsoft.PowerShell.Commands.ConvertFromJsonCommand.EndProcessing()
   at System.Management.Automation.Cmdlet.DoEndProcessing()
   at System.Management.Automation.CommandProcessorBase.Complete()
   --- End of inner exception stack trace ---
   at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
   at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
   at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.CoreInvoke[TOutput](IEnumerable input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)
   at Microsoft.Azure.Commands.Automation.Common.PowerShellJsonConverter.InvokeScript(String scriptName, Hashtable parameters)
   at Microsoft.Azure.Commands.Automation.Common.PowerShellJsonConverter.Deserialize(String json)
   at Microsoft.Azure.Commands.Automation.Common.AutomationPSClient.GetJobStreamRecordAsPsObject(String resourceGroupName, String automationAccountName, Guid jobId, String jobStreamId)
   at Microsoft.Azure.Commands.Automation.Cmdlet.StartAzureAutomationRunbook.AutomationProcessRecord()
   at Microsoft.Azure.Commands.Automation.Cmdlet.AzureAutomationBaseCmdlet.ExecuteCmdlet()
   at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord();
DEBUG: Finish sending metric.
DEBUG: 6:08:55 PM - StartAzureAutomationRunbook end processing.
DEBUG: 6:08:55 PM - StartAzureAutomationRunbook end processing.
PS C:\> Resolve-AzError
DEBUG: 6:11:46 PM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 6:11:46 PM - using account id 'xxxx@xxxxxxx.onmicrosoft.com'...


   HistoryId: 6


Message        : Conversion from JSON failed with error: Unexpected character encountered while parsing value: S. Path '', line 0,
                 position 0.
StackTrace     :    at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
                    at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean
                 performSyncInvoke)
                    at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input,
                 PSDataCollection`1 output, PSInvocationSettings settings)
                    at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input,
                 PSDataCollection`1 output, PSInvocationSettings settings)
                    at System.Management.Automation.PowerShell.CoreInvoke[TOutput](IEnumerable input, PSDataCollection`1 output,
                 PSInvocationSettings settings)
                    at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)
                    at Microsoft.Azure.Commands.Automation.Common.PowerShellJsonConverter.InvokeScript(String scriptName, Hashtable
                 parameters)
                    at Microsoft.Azure.Commands.Automation.Common.PowerShellJsonConverter.Deserialize(String json)
                    at Microsoft.Azure.Commands.Automation.Common.AutomationPSClient.GetJobStreamRecordAsPsObject(String
                 resourceGroupName, String automationAccountName, Guid jobId, String jobStreamId)
                    at Microsoft.Azure.Commands.Automation.Cmdlet.StartAzureAutomationRunbook.AutomationProcessRecord()
                    at Microsoft.Azure.Commands.Automation.Cmdlet.AzureAutomationBaseCmdlet.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : System.Management.Automation.CmdletInvocationException
InvocationInfo : {Start-AzAutomationRunbook}
Line           : Start-AzAutomationRunbook @startParams -Wait -Verbose
Position       : At line:1 char:1
                 + Start-AzAutomationRunbook @startParams -Wait -Verbose
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 6

Message        : Conversion from JSON failed with error: Unexpected character encountered while parsing value: S. Path '', line 0,
                 position 0.
StackTrace     :    at Microsoft.PowerShell.Commands.JsonObject.ConvertFromJson(String input, Boolean returnHashtable, ErrorRecord&
                 error)
                    at Microsoft.PowerShell.Commands.ConvertFromJsonCommand.ConvertFromJsonHelper(String input)
                    at Microsoft.PowerShell.Commands.ConvertFromJsonCommand.EndProcessing()
                    at System.Management.Automation.Cmdlet.DoEndProcessing()
                    at System.Management.Automation.CommandProcessorBase.Complete()
Exception      : System.ArgumentException
InvocationInfo : {Start-AzAutomationRunbook}
Line           : Start-AzAutomationRunbook @startParams -Wait -Verbose
Position       : At line:1 char:1
                 + Start-AzAutomationRunbook @startParams -Wait -Verbose
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 6

Message        : Unexpected character encountered while parsing value: S. Path '', line 0, position 0.
StackTrace     :    at Newtonsoft.Json.JsonTextReader.ParseValue()
                    at Newtonsoft.Json.JsonTextReader.Read()
                    at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
                    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType,
                 Boolean checkAdditionalContent)
                    at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
                    at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
                    at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, JsonSerializerSettings settings)
                    at Microsoft.PowerShell.Commands.JsonObject.ConvertFromJson(String input, Boolean returnHashtable, ErrorRecord&
                 error)
Exception      : Newtonsoft.Json.JsonReaderException
InvocationInfo : {Start-AzAutomationRunbook}
Line           : Start-AzAutomationRunbook @startParams -Wait -Verbose
Position       : At line:1 char:1
                 + Start-AzAutomationRunbook @startParams -Wait -Verbose
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 6

DEBUG: AzureQoSEvent: CommandName - Resolve-AzError; IsSuccess - True; Duration - 00:00:00.1720459; Exception - ;
DEBUG: Finish sending metric.
DEBUG: 6:11:47 PM - ResolveError end processing.
DEBUG: 6:11:47 PM - ResolveError end processing.

@safeermohammed
Copy link
Contributor

@thomasyip-msft, Can you please take a look?

@markcowl markcowl added Automation Service Attention This issue is responsible by Azure service team. and removed Azure PS Team More Info 🏷️ labels Dec 12, 2018
@markcowl markcowl removed this from the 2018-12-18 milestone Dec 12, 2018
@alexandair
Copy link
Contributor Author

@safeermohammed @thomasyip-msft
Any follow-up on this?

@alexandair
Copy link
Contributor Author

@cormacpayne @markcowl
I would really appreciate if someone could fix this annoying error.

@lwajswaj
Copy link
Contributor

hey @alexandair, do you still see this issue with AZ 1.3.0? Particularly with Az.Automation 1.1.0? If so, do you have a example script of the runbook you're trying to run and full list of parameters for Start-AzAutomationRunbook?

@alexandair
Copy link
Contributor Author

@lwajswaj
The issue still exists in Az 1.3.0. And, I'm not the only one. Please, take a look at #8600

@lwajswaj
Copy link
Contributor

lwajswaj commented Feb 22, 2019

Does it happen with any type of runbook or what is the output you are trying to read? (trying to repro, just that)

@tobvil
Copy link

tobvil commented Mar 7, 2019

I have exacly the same issue on pwsh 6.1.3.
No issue on pwsh 5.1
Hope the PR will fix it.

@alexandair
Copy link
Contributor Author

@lwajswaj @cormacpayne This bug is still present in Az 1.6.0.

@leifyumel
Copy link

Is there any update on this issue?

@lwajswaj
Copy link
Contributor

lwajswaj commented May 2, 2019

I wasn't able to complete the previous PR given a business trip and vacation. I'm working to get it merged as soon as I can.

@lwajswaj
Copy link
Contributor

@leifyumel, fix for this issue has been release with AZ 2.1.0 (https://github.com/Azure/azure-powershell/releases/tag/v2.1.0-May2019)

@alexandair
Copy link
Contributor Author

@lwajswaj Thank you.

@alexandair
Copy link
Contributor Author

Unfortunately, even with v2.1.0, I still see the same issue:

VERBOSE: "Job progress state : Id 72369ab0-7d6f-4c50-9a40-29226989b861, state New, time 5/28/2019 1:43:51 PM"
VERBOSE: "Job progress state : Id 72369ab0-7d6f-4c50-9a40-29226989b861, state New, time 5/28/2019 1:43:56 PM"
VERBOSE: "Job progress state : Id 72369ab0-7d6f-4c50-9a40-29226989b861, state Running, time 5/28/2019 1:44:02 PM"
VERBOSE: "Job progress state : Id 72369ab0-7d6f-4c50-9a40-29226989b861, state Running, time 5/28/2019 1:44:07 PM"
VERBOSE: "Job terminal state : Id 72369ab0-7d6f-4c50-9a40-29226989b861, state Completed, time 5/28/2019 1:44:21 PM"
Start-AzAutomationRunbook : Conversion from JSON failed with error: Unexpected character encountered while parsing value: S. Path '', line 0, position 0.

@alexandair alexandair reopened this May 28, 2019
@GaneshMSAzure GaneshMSAzure self-assigned this Oct 15, 2019
@andyw248
Copy link

No repro. Tested with:
Name Value


PSVersion 5.1.17763.771
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.771
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Automation Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

10 participants