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
- Always await the UniTask instead of calling GetResult manually — await handles the completion check internally.
- If using a manual source, ensure TrySetResult is called before any GetResult access.
- 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
- Always use await instead of manual GetResult calls.
- If using UniTaskCompletionSource, ensure TrySetResult is called on all code paths before GetResult.
- In test code, await the task fully before inspecting results.
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
- Channel is already closed.
- Enumerator is already running, does not allow call GetAsyncE
- Attempting to use an invalid operation handle
- continuation is already registered.
- Detected invalid initialization(use 'default'), only to crea
AI-assisted analysis of Cysharp/UniTask@ceac8d6946 (2026-08-13).
Data as JSON: /api/errors/c2fc6b12c9b0cb1e.
Report an issue: GitHub.