{"record":{"id":"950d5d4d8750a8fd","repo":"vxcontrol/pentagi","slug":"w-cannot-move-directory-q-into-itself","errorCode":null,"errorMessage":"%w: cannot move directory %q into itself","messagePattern":"%w: cannot move directory %q into itself","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"backend/pkg/server/services/resources.go","lineNumber":723,"sourceCode":"\t// ── Within-batch target-basename conflict check ───────────────────────────\n\t// Two sources sharing a basename would both land at the same target path.\n\tbasenameToSrc := make(map[string]string, len(srcs))\n\tfor _, src := range srcs {\n\t\tif prev, conflict := basenameToSrc[src.Name]; conflict {\n\t\t\ttx.Rollback()\n\t\t\treturn result, fmt.Errorf(\n\t\t\t\t\"%w: sources %q and %q share the same base name %q\",\n\t\t\t\terrResourceConflict, prev, src.Path, src.Name,\n\t\t\t)\n\t\t}\n\t\tbasenameToSrc[src.Name] = src.Path\n\t}\n\n\t// Self-move guard: no source may be a directory that contains dstPath.\n\tfor _, src := range srcs {\n\t\tif src.IsDir && resources.PathHasPrefix(dstPath, src.Path) {\n\t\t\ttx.Rollback()\n\t\t\treturn result, fmt.Errorf(\n\t\t\t\t\"%w: cannot move directory %q into itself\", errResourceInvalid, src.Path,\n\t\t\t)\n\t\t}\n\t\tif resources.FilePath(dstPath, src.Name) == src.Path {\n\t\t\ttx.Rollback()\n\t\t\treturn result, fmt.Errorf(\n\t\t\t\t\"%w: source and destination are the same for %q\", errResourceInvalid, src.Path,\n\t\t\t)\n\t\t}\n\t}\n\n\t// ── Ensure destination directory ──────────────────────────────────────────\n\tdest, destExists, err := findResourceByPath(tx, uid, dstPath)\n\tif err != nil {\n\t\ttx.Rollback()\n\t\treturn result, err\n\t}\n\tif destExists && !dest.IsDir {","sourceCodeStart":705,"sourceCodeEnd":741,"githubUrl":"https://github.com/vxcontrol/pentagi/blob/ea665308baaff015b226f308438a68d929d0f29b/backend/pkg/server/services/resources.go#L705-L741","documentation":"Error \"%w: cannot move directory %q into itself\" thrown in vxcontrol/pentagi.","triggerScenarios":"Thrown at backend/pkg/server/services/resources.go:723 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ea665308baaff015b226f308438a68d929d0f29b","analyzedAt":"2026-09-01T14:16:31.421Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}