vxcontrol/pentagi · error

%w: cannot move directory %q into itself

Error message

%w: cannot move directory %q into itself

What it means

Error "%w: cannot move directory %q into itself" thrown in vxcontrol/pentagi.

Source

Thrown at backend/pkg/server/services/resources.go:723

	// ── Within-batch target-basename conflict check ───────────────────────────
	// Two sources sharing a basename would both land at the same target path.
	basenameToSrc := make(map[string]string, len(srcs))
	for _, src := range srcs {
		if prev, conflict := basenameToSrc[src.Name]; conflict {
			tx.Rollback()
			return result, fmt.Errorf(
				"%w: sources %q and %q share the same base name %q",
				errResourceConflict, prev, src.Path, src.Name,
			)
		}
		basenameToSrc[src.Name] = src.Path
	}

	// Self-move guard: no source may be a directory that contains dstPath.
	for _, src := range srcs {
		if src.IsDir && resources.PathHasPrefix(dstPath, src.Path) {
			tx.Rollback()
			return result, fmt.Errorf(
				"%w: cannot move directory %q into itself", errResourceInvalid, src.Path,
			)
		}
		if resources.FilePath(dstPath, src.Name) == src.Path {
			tx.Rollback()
			return result, fmt.Errorf(
				"%w: source and destination are the same for %q", errResourceInvalid, src.Path,
			)
		}
	}

	// ── Ensure destination directory ──────────────────────────────────────────
	dest, destExists, err := findResourceByPath(tx, uid, dstPath)
	if err != nil {
		tx.Rollback()
		return result, err
	}
	if destExists && !dest.IsDir {

View on GitHub (pinned to ea665308ba)

When it happens

Trigger: Thrown at backend/pkg/server/services/resources.go:723 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of vxcontrol/pentagi@ea665308ba (2026-09-01). Data as JSON: /api/errors/950d5d4d8750a8fd. Report an issue: GitHub.