dagger/dagger · error

decode persisted container withoutDefaultArgs lazy payload:

Error message

decode persisted container withoutDefaultArgs lazy payload: %w

What it means

This error wraps a json.Unmarshal failure while decoding the persisted lazy payload for a Container's withoutDefaultArgs operation during lazy replay. The payload for case "withoutDefaultArgs" must decode into persistedContainerWithoutDefaultArgsLazy; if it does not, the error is returned with the underlying JSON reason wrapped via %w. It indicates persisted-state corruption or a schema mismatch, not a container issue.

Source

Thrown at core/container.go:4284

	case "withDefaultArgs":
		var persisted persistedContainerWithDefaultArgsLazy
		if err := json.Unmarshal(payload, &persisted); err != nil {
			return fmt.Errorf("decode persisted container withDefaultArgs lazy payload: %w", err)
		}
		parent, err := loadPersistedObjectResultByResultID[*Container](ctx, dag, persisted.ParentResultID, "container withDefaultArgs parent")
		if err != nil {
			return err
		}
		container.Lazy = &ContainerWithDefaultArgsLazy{
			LazyState: NewLazyState(),
			Parent:    parent,
			Args:      persisted.Args,
		}
		return nil
	case "withoutDefaultArgs":
		var persisted persistedContainerWithoutDefaultArgsLazy
		if err := json.Unmarshal(payload, &persisted); err != nil {
			return fmt.Errorf("decode persisted container withoutDefaultArgs lazy payload: %w", err)
		}
		parent, err := loadPersistedObjectResultByResultID[*Container](ctx, dag, persisted.ParentResultID, "container withoutDefaultArgs parent")
		if err != nil {
			return err
		}
		container.Lazy = &ContainerWithoutDefaultArgsLazy{
			LazyState: NewLazyState(),
			Parent:    parent,
		}
		return nil
	case "withUser":
		var persisted persistedContainerWithUserLazy
		if err := json.Unmarshal(payload, &persisted); err != nil {
			return fmt.Errorf("decode persisted container withUser lazy payload: %w", err)
		}
		parent, err := loadPersistedObjectResultByResultID[*Container](ctx, dag, persisted.ParentResultID, "container withUser parent")
		if err != nil {
			return err

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Clear the Dagger engine cache to force regeneration of the payload
  2. Ensure engine and CLI versions match
  3. Verify the payload JSON has required fields (parentResultID) with correct types
  4. Re-run the pipeline with a fresh session so the chain is re-encoded

Example fix

// before: stale cache replay
container.WithoutDefaultArgs() // decode persisted container withoutDefaultArgs lazy payload: ...
// after: purge cache and re-run
container.WithoutDefaultArgs() // fresh payload decodes successfully
Defensive patterns

Strategy: try-catch

Validate before calling

var probe map[string]any
if err := json.Unmarshal(payload, &probe); err != nil {
	return fmt.Errorf("persisted withoutDefaultArgs payload is not valid JSON: %w", err)
}
if _, ok := probe["parentResultID"]; !ok {
	return errors.New("persisted withoutDefaultArgs payload missing parentResultID")
}

Type guard

func isValidWithoutDefaultArgsLazyPayload(payload []byte) bool {
	var p persistedContainerWithoutDefaultArgsLazy
	return json.Unmarshal(payload, &p) == nil && p.ParentResultID != ""
}

Try / catch

if err := decodeWithoutDefaultArgsLazy(ctx, dag, payload, container); err != nil {
	if isUnmarshalError(err) {
		logger.Warn("corrupt persisted withoutDefaultArgs payload; regenerating")
		return rebuildContainerChainFromSource(ctx, container)
	}
	return err
}

Prevention

When it happens

Trigger: Calling Container.WithoutDefaultArgs within a persisted lazy chain whose stored payload is malformed JSON or was produced by an incompatible schema version.

Common situations: Cache from an older Dagger version replayed by newer code; partially written or corrupted cache entries; manual migration/edits of persisted results; schema field changes without cache busting.

Understand the failure class

Background: "failed to unmarshal" / json.Unmarshal errors: why parsing a response into a Go struct fails and how to fix it — this error's family across 23 libraries.

Related errors


AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05). Data as JSON: /api/errors/ce0d7aa05c7e1758. Report an issue: GitHub.