Read logs and results#
await invocation.result() waits for terminal state and returns the Task result. Log streaming is enabled by default; pass stream_logs=False to suppress it, or verbose_system_logs=True to include system log lines. await invocation.status() reads the current state without waiting for completion.
For the result-waiting Task call shapes, task.remote(...) and await task.remote.aio(...) return the Task result directly. Use await task.remote_async(...) when you need an Invocation handle before waiting.
Separate failure classes#
| What happened | How it appears | What to check |
|---|---|---|
| Task code raised an exception | Invocation.result() raises InvocationExecutionError after the Invocation fails | Read the Task logs and exception details; fix or handle the code path |
| Invocation was cancelled | InvocationCancelledError | Check who requested cancellation and whether the caller should retry |
| Invocation reached its deadline | InvocationTimedOutError | Check the configured execution timeout and whether the work can be bounded or split |
| Authentication was rejected | AuthenticationError or a CLI authentication error before a usable result | Run yak init, then verify account access and selected Environment/Workspace |
| The client could not reach Yak | ConnectionError | Check network access and client configuration; reconnect and query Invocation state before resubmitting uncertain work |
| Image preparation or build failed | Registration/run reports a build error before the Task starts | Review the first failing build output and compare the Image instructions with the supported subset |
| Mount or storage setup failed | Invocation setup fails before the Task callable starts | Verify named Secret scope, bucket/prefix access, mount paths and Volume availability |
| Volume file or lifecycle operation failed | Volume-specific exception or a familiar file exception | Check the Volume name, Environment, path and whether another operation has it reserved |
The public Python exception names are InvocationExecutionError, InvocationCancelledError, InvocationTimedOutError, AuthenticationError, ConnectionError, DeploymentError, and the Volume exceptions documented in the generated reference . Image-build and mount-setup failures are surfaced at their preparation boundary; do not interpret them as an exception raised by the Task’s Python code.
Avoid duplicate work after transport errors#
A connection failure can happen while submitting, waiting, streaming logs or requesting cancellation. It means the client did not receive a complete response; it does not prove that remote work never started. If an Invocation ID is available, query its state first. If the submit response was lost and the ID is unavailable, design retried Tasks to tolerate duplicate work when their side effects require it.
Next steps#
Use Cancellation for explicit stop behavior, Resource Usage for settled measurements, and Troubleshooting for a step-by-step diagnosis path.