dagger/dagger · error

decode persisted file lazy payload: unsupported lazy kind %q

Error message

decode persisted file lazy payload: unsupported lazy kind %q

What it means

Returned when decodePersistedFileLazy encounters a lazy-kind discriminator it does not recognize in a persisted file lazy payload. The kind string comes from the persisted blob; an unknown value means the state was written by a newer Dagger version (with a new lazy kind) or the payload is corrupted. The decoder refuses rather than misinterpreting unknown state.

Source

Thrown at core/file.go:494

			return nil, fmt.Errorf("decode persisted file withTimestamps lazy: %w", err)
		}
		parent, err := loadPersistedObjectResultByResultID[*File](ctx, dag, persisted.ParentResultID, "file withTimestamps parent")
		if err != nil {
			return nil, err
		}
		return &FileWithTimestampsLazy{LazyState: NewLazyState(), Parent: parent, Timestamp: persisted.Timestamp}, nil
	case persistedFileLazyKindChown:
		var persisted persistedFileChownLazy
		if err := json.Unmarshal(payload, &persisted); err != nil {
			return nil, fmt.Errorf("decode persisted file chown lazy: %w", err)
		}
		parent, err := loadPersistedObjectResultByResultID[*File](ctx, dag, persisted.ParentResultID, "file chown parent")
		if err != nil {
			return nil, err
		}
		return &FileChownLazy{LazyState: NewLazyState(), Parent: parent, Owner: persisted.Owner}, nil
	default:
		return nil, fmt.Errorf("decode persisted file lazy payload: unsupported lazy kind %q", lazyKind)
	}
}

func (lazy *FileBlobLazy) Evaluate(ctx context.Context, file *File) error {
	return lazy.LazyState.Evaluate(ctx, "File.blob", func(ctx context.Context) error {
		if dir, _ := filepath.Split(lazy.Filename); dir != "" {
			return fmt.Errorf("file name %q must not contain a directory", lazy.Filename)
		}
		if err := ValidateFileName(lazy.Filename); err != nil {
			return err
		}
		permissions := lazy.Permissions
		if permissions == 0 {
			permissions = 0o644
		}

		query, err := CurrentQuery(ctx)
		if err != nil {

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Upgrade Dagger to a version that supports the persisted lazy kind in the payload
  2. Clear the incompatible persisted state and re-run the pipeline
  3. Verify kind constants (persistedFileLazyKind*) match between the encoder and decoder in your build
  4. Log the %q kind value to confirm whether it is a new kind or corruption
Defensive patterns

Strategy: validation

Validate before calling

knownKinds := map[string]bool{
    persistedFileLazyKindBlob: true,
    persistedFileLazyKindContainerFile: true,
    persistedFileLazyKindWithName: true,
    persistedFileLazyKindWithReplaced: true,
    persistedFileLazyKindWithTimestamps: true,
    persistedFileLazyKindChown: true,
}
if !knownKinds[kind] { /* unknown kind: re-derive state or upgrade engine */ }

Type guard

func isKnownLazyKind(kind string) bool {
    switch kind {
    case persistedFileLazyKindBlob, persistedFileLazyKindContainerFile,
        persistedFileLazyKindWithName, persistedFileLazyKindWithReplaced,
        persistedFileLazyKindWithTimestamps, persistedFileLazyKindChown:
        return true
    }
    return false
}

Prevention

When it happens

Trigger: Loading a persisted lazy file whose kind field contains a value with no case in the switch (e.g. a lazy kind introduced in a newer Dagger release, a truncated/garbled kind string, or a hand-edited payload).

Common situations: Downgrading the engine after newer code persisted new lazy kinds; corrupted state store flipping bytes in the kind field; mixing persisted state between forks/branches with divergent kind constants.

Related errors


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