{"record":{"id":"ce11b3e07fc2a725","repo":"vxcontrol/pentagi","slug":"w-two-sources-both-target-q","errorCode":null,"errorMessage":"%w: two sources both target %q","messagePattern":"%w: two sources both target %q","errorType":"http","errorClass":null,"httpStatus":409,"severity":"error","filePath":"backend/pkg/server/services/flow_files.go","lineNumber":1907,"sourceCode":"\t\t\t\tif relErr != nil {\n\t\t\t\t\treturn fmt.Errorf(\"relative path: %w\", relErr)\n\t\t\t\t}\n\t\t\t\tsanitized, sanitizeErr := resources.SanitizeResourcePath(\n\t\t\t\t\tsrc.destPath + \"/\" + filepath.ToSlash(rel),\n\t\t\t\t)\n\t\t\t\tif sanitizeErr != nil {\n\t\t\t\t\tlog.WithError(sanitizeErr).Warnf(\"skipping unsafe file name %q\", rel)\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tvirtPath = sanitized\n\t\t\t} else {\n\t\t\t\tvirtPath = src.destPath\n\t\t\t}\n\n\t\t\t// Within-batch collision check: two sources mapping to the same\n\t\t\t// virtual destination path is always an error.\n\t\t\tif seenVPaths[virtPath] {\n\t\t\t\treturn fmt.Errorf(\"%w: two sources both target %q\", errResourceConflict, virtPath)\n\t\t\t}\n\t\t\tseenVPaths[virtPath] = true\n\n\t\t\t// Phase 1 conflict pre-check: avoid IO when the destination\n\t\t\t// obviously conflicts. Phase 3 re-checks inside the TX.\n\t\t\tif !force {\n\t\t\t\t_, exists, dbErr := findResourceByPath(s.db, uid, virtPath)\n\t\t\t\tif dbErr != nil {\n\t\t\t\t\treturn fmt.Errorf(\"checking %s: %w\", virtPath, dbErr)\n\t\t\t\t}\n\t\t\t\tif exists {\n\t\t\t\t\treturn fmt.Errorf(\"%w: resource already exists at %q\", errResourceConflict, virtPath)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tf, openErr := os.Open(filePath)\n\t\t\tif openErr != nil {\n\t\t\t\treturn fmt.Errorf(\"open %s: %w\", filePath, openErr)","sourceCodeStart":1889,"sourceCodeEnd":1925,"githubUrl":"https://github.com/vxcontrol/pentagi/blob/ea665308baaff015b226f308438a68d929d0f29b/backend/pkg/server/services/flow_files.go#L1889-L1925","documentation":"Error \"%w: two sources both target %q\" thrown in vxcontrol/pentagi.","triggerScenarios":"Thrown at backend/pkg/server/services/flow_files.go:1907 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"}