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 happenedHow it appearsWhat to check
Task code raised an exceptionInvocation.result() raises InvocationExecutionError after the Invocation failsRead the Task logs and exception details; fix or handle the code path
Invocation was cancelledInvocationCancelledErrorCheck who requested cancellation and whether the caller should retry
Invocation reached its deadlineInvocationTimedOutErrorCheck the configured execution timeout and whether the work can be bounded or split
Authentication was rejectedAuthenticationError or a CLI authentication error before a usable resultRun yak init, then verify account access and selected Environment/Workspace
The client could not reach YakConnectionErrorCheck network access and client configuration; reconnect and query Invocation state before resubmitting uncertain work
Image preparation or build failedRegistration/run reports a build error before the Task startsReview the first failing build output and compare the Image instructions with the supported subset
Mount or storage setup failedInvocation setup fails before the Task callable startsVerify named Secret scope, bucket/prefix access, mount paths and Volume availability
Volume file or lifecycle operation failedVolume-specific exception or a familiar file exceptionCheck 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.