We are running a basic PDF-DOCX conversion using the .NET SDK. This had worked for us previously, and has recently started failing (unfortunately aligning with our production go-live). It could also be related to the production server having higher capacity, and running faster.
This is our basic job structure:
var job = await _cloudConvertClient.CreateJobAsync(new JobCreateRequest
{
Tasks = new
{
upload_pdf = new ImportUploadCreateRequest(),
convert = new ConvertCreateRequest()
{
Input = UploadTaskName,
Input_Format = "pdf",
Output_Format = "docx",
},
export_it = new ExportUrlCreateRequest()
{
Input = ConvertTaskName
}
}
});
We upload the PDF, wait for that to complete and check for success status. Then we wait for conversion job to complete:
Response<TaskResponse>? conversionResult;
do
{
conversionResult = await _cloudConvertClient.WaitTaskAsync(conversionTask!.Id);
}
while (conversionResult.Data.Status == TaskStatus.processing || conversionResult.Data.Status == TaskStatus.waiting);
At this point we get a deserialisation error:
2026-05-07T11:30:15.3820567Z An error occurred while downloading report with ID 15300
2026-05-07T11:30:15.3820631Z System.Text.Json.JsonException: The JSON value could not be converted to System.Nullable`1[System.Int32]. Path: $.data.credits | LineNumber: 0 | BytePositionInLine: 151.
2026-05-07T11:30:15.3820676Z ---> System.InvalidOperationException: Cannot get the value of a token type 'String' as a number.
2026-05-07T11:30:15.3820724Z at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_ExpectedNumber(JsonTokenType tokenType)
2026-05-07T11:30:15.3820766Z at System.Text.Json.Serialization.Converters.Int32Converter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
2026-05-07T11:30:15.3820833Z at System.Text.Json.Serialization.Converters.NullableConverter`1.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
2026-05-07T11:30:15.3820881Z at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
2026-05-07T11:30:15.3820928Z at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
2026-05-07T11:30:15.3820977Z at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
2026-05-07T11:30:15.3821572Z at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
2026-05-07T11:30:15.3821645Z at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
2026-05-07T11:30:15.3821695Z at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state)
2026-05-07T11:30:15.3821771Z --- End of inner exception stack trace ---
2026-05-07T11:30:15.3821848Z at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex)
2026-05-07T11:30:15.3821898Z at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state)
2026-05-07T11:30:15.3822008Z at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 json, JsonTypeInfo`1 jsonTypeInfo)
2026-05-07T11:30:15.3822054Z at CloudConvert.API.RestHelper.RequestAsync[T](HttpRequestMessage request, CancellationToken cancellationToken)
I can't find a way to view the raw JSON, but it looks like the credits field is coming back as a string (possibly empty string '') that can't be deserialised to a nullable integer int?.
But this is only an issue while the task is processing. If we introduce an artificial 10s delay before checking the conversion task, it succeeds every time.
We are running a basic PDF-DOCX conversion using the .NET SDK. This had worked for us previously, and has recently started failing (unfortunately aligning with our production go-live). It could also be related to the production server having higher capacity, and running faster.
This is our basic job structure:
We upload the PDF, wait for that to complete and check for success status. Then we wait for conversion job to complete:
At this point we get a deserialisation error:
I can't find a way to view the raw JSON, but it looks like the
creditsfield is coming back as a string (possibly empty string'') that can't be deserialised to a nullable integerint?.But this is only an issue while the task is processing. If we introduce an artificial 10s delay before checking the conversion task, it succeeds every time.