NickeManarin/ScreenToGif · error · UploadException

{errorDescriptor.Error}, {errorDescriptor.Message}, {errorDe

Error message

{errorDescriptor.Error}, {errorDescriptor.Message}, {errorDescriptor.Description}

What it means

Inside GetAsync<T>, the response body is first deserialized as an ErrorDescriptor; if its Error field is non-null, UploadException is thrown carrying the Yandex-provided error/message/description triple verbatim. This is the user-facing passthrough of any Yandex Disk REST API failure.

Source

Thrown at ScreenToGif/Cloud/YandexDisk.cs:78

        {
            var request = new HttpRequestMessage(HttpMethod.Get, url)
            {
                Headers =
                {
                    {HttpRequestHeader.Authorization.ToString(), "OAuth " + preset.OAuthToken}
                }
            };

            string responseBody;
            using (var response = await client.SendAsync(request, cancellationToken))
            {
                responseBody = await response.Content.ReadAsStringAsync(cancellationToken);
            }
                
            var errorDescriptor = Serializer.Deserialize<ErrorDescriptor>(responseBody);

            if (errorDescriptor.Error != null)
                throw new UploadException($"{errorDescriptor.Error}, {errorDescriptor.Message}, {errorDescriptor.Description}");

            return Serializer.Deserialize<T>(responseBody);
        }
    }

    private async Task PutAsync(YandexPreset preset, string url, HttpContent content, CancellationToken cancellationToken)
    {
        var handler = new HttpClientHandler
        {
            Proxy = WebHelper.GetProxy(),
            PreAuthenticate = true,
            UseDefaultCredentials = false,
        };

        using (var client = new HttpClient(handler))
        {
            var request = new HttpRequestMessage(HttpMethod.Put, url)
            {

View on GitHub (pinned to a4d0a67c21)

Solutions

  1. Re-authorize Yandex if the message indicates unauthorized/invalid token.
  2. Free up Yandex Disk space if the message indicates DiskFull / quota exceeded.
  3. Surface the triple (error, message, description) directly to the user rather than the generic label.
  4. Add an HttpStatusCode check on response.StatusCode before deserializing, so non-200 responses are handled explicitly.

Example fix

// before
if (errorDescriptor.Error != null)
    throw new UploadException($"{errorDescriptor.Error}, {errorDescriptor.Message}, {errorDescriptor.Description}");

// after
if ((int)response.StatusCode >= 400 || errorDescriptor.Error != null)
    throw new UploadException($"Yandex {errorDescriptor.Error ?? response.StatusCode.ToString()}: {errorDescriptor.Message}. {errorDescriptor.Description}");
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-flight: token must be present and quota assumed available
var yp = preset as YandexPreset;
if (string.IsNullOrWhiteSpace(yp?.OAuthToken)) /* prompt re-auth */

Type guard

// n/a — error is data-driven, not type-driven

Try / catch

try { return await cloud.UploadFileAsync(preset, path, token); }
catch (UploadException ex) when (ex.Message.Contains("unauthorized") || ex.Message.Contains("UnauthorizedError"))
{ /* refresh OAuth token, retry once */ }
catch (UploadException ex) when (ex.Message.Contains("DiskFull"))
{ /* surface quota message to user */ }

Prevention

When it happens

Trigger: Any Yandex cloud-api.yandex.net response containing a JSON 'error' field: 401 unauthorized (bad OAuth token), 406 invalid field, 413 file too large, 507 disk full, rate limiting, or ' DiskResourcePathNotFoundError'. The HTTP status itself is not checked — only the body's error field.

Common situations: Expired or revoked OAuth token; Yandex Disk quota exceeded (507 disk full); upload path collisions or forbidden characters; rate-limit response; region/network returned a Yandex-formatted error JSON.

Related errors


AI-assisted analysis of NickeManarin/ScreenToGif@a4d0a67c21 (2026-08-13). Data as JSON: /api/errors/87f4e7e9506903ae. Report an issue: GitHub.