kopia/kopia · error

create directory

Error message

create directory

What it means

Wrapper in copyDirectory's shallow path: WriteDirEntry on the shallow (tar/zip) output failed while emitting a placeholder directory entry for a subtree beyond maxdepth, so the shallow restore cannot represent that directory.

Solutions

  1. Check target filesystem permissions and space.
  2. Retry; if persistent, avoid shallow restore for this snapshot.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at snapshot/restore/restore.go:281 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kopia/kopia@82495e54b5 (2026-09-07). Data as JSON: /api/errors/514565f730bc895a. Report an issue: GitHub.

Appendix: source

Thrown at snapshot/restore/restore.go:281

		return onCompletion()

	default:
		return errors.Errorf("invalid FS entry type for %q: %#v", targetPath, e)
	}
}

func (c *copier) copyDirectory(ctx context.Context, d fs.Directory, targetPath string, currentdepth, maxdepth int32, onCompletion parallelwork.CallbackFunc) error {
	c.stats.RestoredDirCount.Add(1)

	if SafelySuffixablePath(targetPath) && currentdepth > maxdepth {
		de, ok := d.(snapshot.HasDirEntry)
		if !ok {
			return errors.Errorf("fs.Directory '%s' object is not HasDirEntry?", d.Name())
		}

		if err := c.shallowoutput.WriteDirEntry(ctx, targetPath, de.DirEntry(), d); err != nil {
			return errors.Wrap(err, "create directory")
		}

		return onCompletion()
	}

	if err := c.output.BeginDirectory(ctx, targetPath, d); err != nil {
		return errors.Wrap(err, "create directory")
	}

	if c.deleteExtra {
		// deleting existing files only makes sense in the context of an actual filesystem (compared to a tar or zip)
		if fsOutput, isFileSystem := c.output.(*FilesystemOutput); isFileSystem {
			if err := c.deleteExtraFilesInDir(ctx, fsOutput, d, targetPath); err != nil {
				return errors.Wrap(err, "delete extra")
			}
		}
	}

View on GitHub (pinned to 82495e54b5)