{"record":{"id":"7d044fbe11300f4f","repo":"vxcontrol/pentagi","slug":"w-a-directory-already-exists-at-q","errorCode":null,"errorMessage":"%w: a directory already exists at %q","messagePattern":"%w: a directory already exists at %q","errorType":"http","errorClass":null,"httpStatus":409,"severity":"error","filePath":"backend/pkg/server/services/flow_files.go","lineNumber":2056,"sourceCode":"\t\t\t\ttxErr = dirErr\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tallDirs = append(allDirs, subDirs...)\n\t\t\torphanHashes = append(orphanHashes, subOrphans...)\n\t\t}\n\n\t\texisting, exists, lookErr := findResourceByPath(tx, uid, p.vPath)\n\t\tif lookErr != nil {\n\t\t\ttxErr = lookErr\n\t\t\tbreak\n\t\t}\n\t\tif exists {\n\t\t\tif !force {\n\t\t\t\ttxErr = fmt.Errorf(\"%w: resource already exists at %q\", errResourceConflict, p.vPath)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif existing.IsDir {\n\t\t\t\ttxErr = fmt.Errorf(\"%w: a directory already exists at %q\", errResourceConflict, p.vPath)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif existing.Hash != \"\" && existing.Hash != p.hash {\n\t\t\t\torphanHashes = append(orphanHashes, existing.Hash)\n\t\t\t}\n\t\t\tnow := time.Now()\n\t\t\tif updErr := tx.Model(&existing).Updates(models.UserResource{\n\t\t\t\tHash: p.hash, Name: p.name, Size: p.size, UpdatedAt: now,\n\t\t\t}).Error; updErr != nil {\n\t\t\t\ttxErr = updErr\n\t\t\t\tbreak\n\t\t\t}\n\t\t\texisting.Hash, existing.Name, existing.Size, existing.UpdatedAt = p.hash, p.name, p.size, now\n\t\t\tupdated = append(updated, existing)\n\t\t\tcontinue\n\t\t}\n\n\t\trec := models.UserResource{","sourceCodeStart":2038,"sourceCodeEnd":2074,"githubUrl":"https://github.com/vxcontrol/pentagi/blob/ea665308baaff015b226f308438a68d929d0f29b/backend/pkg/server/services/flow_files.go#L2038-L2074","documentation":"Error \"%w: a directory already exists at %q\" thrown in vxcontrol/pentagi.","triggerScenarios":"Thrown at backend/pkg/server/services/flow_files.go:2056 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"}