Cysharp/UniTask · error · InvalidOperationException

Not yet completed.

Error message

Not yet completed.

What it means

Thrown by Error.ThrowNotYetCompleted() when GetResult() is called on a non-generic UniTask source that has not yet reached a completed state. UniTask is a value-type promise; its result can only be retrieved after the underlying source signals completion. Calling GetResult early is a contract violation.

Source

Thrown at src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/Error.cs:50

            return new InvalidOperationException("Source sequence doesn't contain any elements.");
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static Exception MoreThanOneElement()
        {
            return new InvalidOperationException("Source sequence contains more than one element.");
        }

        [MethodImpl(MethodImplOptions.NoInlining)]
        public static void ThrowArgumentException(string message)
        {
            throw new ArgumentException(message);
        }

        [MethodImpl(MethodImplOptions.NoInlining)]
        public static void ThrowNotYetCompleted()
        {
            throw new InvalidOperationException("Not yet completed.");
        }

        [MethodImpl(MethodImplOptions.NoInlining)]
        public static T ThrowNotYetCompleted<T>()
        {
            throw new InvalidOperationException("Not yet completed.");
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static void ThrowWhenContinuationIsAlreadyRegistered<T>(T continuationField)
          where T : class
        {
            if (continuationField != null) ThrowInvalidOperationExceptionCore("continuation is already registered.");
        }

        [MethodImpl(MethodImplOptions.NoInlining)]
        static void ThrowInvalidOperationExceptionCore(string message)
        {

View on GitHub (pinned to ceac8d6946)

Solutions

  1. Always await the UniTask instead of calling GetResult manually — await handles the completion check internally.
  2. If using a manual source, ensure TrySetResult is called before any GetResult access.
  3. If you must poll, check source.Status == UniTaskStatus.Succeeded before calling GetResult.

Example fix

// before
var source = new UniTaskCompletionSource();
source.GetResult(0); // throws: not yet completed

// after
var source = new UniTaskCompletionSource();
source.TrySetResult();
source.GetResult(0); // ok
Defensive patterns

Strategy: validation

Validate before calling

// Check status before calling GetResult
if (source.GetStatus(shortVersion) == UniTaskStatus.Pending)
{
    // not ready yet; await instead
    await source.Task;
}
source.GetResult(shortVersion);

Prevention

When it happens

Trigger: Manually invoking GetResult() on a UniTaskManualSource, UniTaskCompletionSource, or configured source before TrySetResult/TrySetCanceled/TrySetException has been called. Polling code that accesses GetResult without first checking Status.

Common situations: Low-level code that bypasses await and calls GetResult directly. A source that was created but never signaled due to a logic error. Test code that inspects a task before it completes.

Related errors


AI-assisted analysis of Cysharp/UniTask@ceac8d6946 (2026-08-13). Data as JSON: /api/errors/c2fc6b12c9b0cb1e. Report an issue: GitHub.