Repository navigation
Description
What happens
When a function in an entrypoint module (dagger-module.toml with [entrypoint]) throws, the failure is cached. Calling the function again replays the same error without running it, until the engine prunes the cache.
Why
The generated dispatcher (__dagger.dispatch.ts) catches the thrown error, writes { "error": { "message": … } } to stdout and exits 0. The entrypoint then decodes that reply and raises the message.
Because the exec exits 0, the engine treats it as a success and caches it under the call digest (DAGGER_MODULE_CALL_DIGEST):
- The call fails at the
raise, so dagql keeps no result for it. - The next evaluation of the same call runs the entrypoint again.
- The entrypoint's
withExecis now a cache hit, so the cached{ "error": … }reply comes back and is raised again. The function never runs.
So a transient failure, such as a network blip, a registry hiccup or a flaky test, keeps failing for every default-cached function. Functions cached never, per session or with a TTL are not affected, because their call digest changes. Go, Java and Python entrypoint modules don't have this problem: their dispatchers exit non-zero, so the exec fails and is never cached. The builtin runtime never cached a failure either.
design/module-entrypoint.md §6.3 and §10.5 chose the exit-0 reply so the message would survive. Caching isn't mentioned there.
Reproduction
Take a fixture function that throws a new nonce every time:
@func()
nonceFailure(): Container {
throw new Error("RuntimeNode nonce: " + crypto.randomUUID())
}Call it twice in one session, here through ws.artifacts(include: ["runtime-node:nonce-failure"]).items.{{ value.{{ id }} }} from the runtimes checks module, on engine-e2e's pinned engine. Both calls fail with the same nonce, and the second one takes 0.0s:
✘ call module entrypoint 1.4s ERROR
! call module entrypoint: RuntimeNode nonce: 789f8df7-6ad6-4c54-823d-32f3d458cb95
✘ call module entrypoint 0.0s ERROR
! call module entrypoint: RuntimeNode nonce: 789f8df7-6ad6-4c54-823d-32f3d458cb95
Fix
Keep the stdout reply, but exit non-zero after an error reply. A failed exec keeps the tail of its stdout in its ExecError, so the entrypoint can rescue the failed exec, read the reply from extensions.stdout, and raise its message. When there is no reply, it re-raises the exec's own error.
Activity