{"record":{"id":"db8882aeba9b8162","repo":"docker/compose","slug":"output-folder-s-already-exists","errorCode":null,"errorMessage":"output folder %s already exists","messagePattern":"output folder (.+?) already exists","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/bridge/transformers.go","lineNumber":53,"sourceCode":"\ttemplatesPath = \"/templates\"\n)\n\ntype CreateTransformerOptions struct {\n\tDest string\n\tFrom string\n}\n\nfunc CreateTransformer(ctx context.Context, dockerCli command.Cli, options CreateTransformerOptions) error {\n\tif options.From == \"\" {\n\t\toptions.From = DefaultTransformerImage\n\t}\n\tout, err := filepath.Abs(options.Dest)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := os.Stat(out); err == nil {\n\t\treturn fmt.Errorf(\"output folder %s already exists\", out)\n\t}\n\n\ttmpl := filepath.Join(out, \"templates\")\n\terr = os.MkdirAll(tmpl, 0o744)\n\tif err != nil && !os.IsExist(err) {\n\t\treturn fmt.Errorf(\"cannot create output folder: %w\", err)\n\t}\n\n\tif err := command.ValidateOutputPath(out); err != nil {\n\t\treturn err\n\t}\n\n\tcreated, err := dockerCli.Client().ContainerCreate(ctx, client.ContainerCreateOptions{\n\t\tImage: options.From,\n\t})\n\n\tdefer func() {\n\t\t_, _ = dockerCli.Client().ContainerRemove(context.Background(), created.ID, client.ContainerRemoveOptions{","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/pkg/bridge/transformers.go#L35-L71","documentation":"bridge.CreateTransformer scaffolds a new transformer by materializing a folder from a container image (default DefaultTransformerImage). As a safety guard it refuses to run if the destination path already exists (os.Stat succeeds), so it never overwrites or merges into an existing folder. The message prints the absolute destination path.","triggerScenarios":"Calling CreateTransformer with options.Dest set to an existing directory or file; running the scaffolding command twice with the same destination; a previous partial run that left the folder behind.","commonSituations":"Re-running a transformer-creation command after an interrupted first attempt; pointing Dest at a checked-in project directory that already exists; CI caching that preserves the destination between runs.","solutions":["Choose a fresh destination path that does not exist yet","Remove or rename the existing folder if its contents are disposable: rm -rf <dest>","Move the existing folder aside (mv dest dest.bak) if you need to compare or preserve it"],"exampleFix":"# before\n$ create-transformer --dest ./my-transformer\noutput folder /path/to/my-transformer already exists\n# after\n$ mv ./my-transformer ./my-transformer.bak\n$ create-transformer --dest ./my-transformer\n","handlingStrategy":"validation","validationCode":"// Before CreateTransformer:\nif _, err := os.Stat(options.Dest); err == nil {\n\treturn fmt.Errorf(\"destination %s already exists, pick a new path or remove it\", options.Dest)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate a fresh destination per run (timestamp or uuid suffix) in automation","Clean or version transformer output dirs in CI between runs","Treat CreateTransformer as scaffolding: run once, commit the result"],"tags":["filesystem","transformer","bridge","validation"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}