Confusing error message for "organize" when source refers to multiples items and destination doesn't end up with /
Metadata
Current evaluation
Snapcraft 2.26 (2017) reports a misleading 'already exists' error when an organize glob matches multiple items and the destination lacks a trailing slash; reporter suggests auto-treating the destination as a directory. No maintainer response; code has since moved to craft-parts.
Suggested action: needs triage
Reason: Zero comments, no labels, no maintainer acknowledgement in ~9 years (last activity 3317 days ago, snapcraft 2.26 on Ubuntu 16.04). The organize logic now lives in craft-parts (craft_parts/executor/organize.py), and I could not confirm via tools whether the multi-item-glob-to-file-destination case is still reproducible or was addressed, so a human should verify before closing as stale or as fixed.
Impact:
25
Quick Win:
15.0
Staleness:
95
Complexity:
40
Confidence:
55
Support Request:
10
Issue body
A simple parts stenza with:
organize:
'*': foo
will lead to this error message:
Trying to organize file '*' to 'foo', but 'foo' already exists
Which isn't the case (foo doesn't exists in stage/ nor prime/).
I guess triggering situation is that * is a directory content with multiple items and destination is what looks like a filename to snapcraft. My bet is that the first item copy happens, and when trying to copy the second file/directory, we thus already have a "foo" file or directory corresponding to the first item to copy. Then, the error makes sense :)
However, this is confusing to the user.
The fix is of course to tell snapcraft to copy to a directory by appending /:
organize:
'*': foo/
My feeling is that the final / shouldn't be needed though and we should, in case of having a blob regexp, treat the right parts of the expression as a directory if there is more than one item matched.
ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: snapcraft 2.26
ProcVersionSignature: Ubuntu 4.4.0-62.83-generic 4.4.40
Uname: Linux 4.4.0-62-generic x86_64
NonfreeKernelModules: zfs zunicode zcommon znvpair zavl
ApportVersion: 2.20.1-0ubuntu2.5
Architecture: amd64
CurrentDesktop: Unity
Date: Thu Feb 9 14:09:30 2017
InstallationDate: Installed on 2012-05-28 (1717 days ago)
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release amd64 (20120425)
PackageArchitecture: all
SourcePackage: snapcraft
UpgradeStatus: Upgraded to xenial on 2014-10-31 (832 days ago)
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.8-27b |
Impact:
25
Quick Win:
15.0
Staleness:
95
Complexity:
40
Confidence:
55
Support Request:
10
|
needs triage | Snapcraft 2.26 (2017) reports a misleading 'already exists' error when an organize glob matches multiple items and the destination lacks a trailing slash; reporter suggests auto-treating the destination as a directory. No maintainer response; code has since moved to craft-parts. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
98
Complexity:
15
Confidence:
95
Support Request:
0
|
close stale | Bug report from 2017 regarding a confusing error message in snapcraft 2.26 when organizing multiple source files to a destination without a trailing slash. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
98
Complexity:
25
Confidence:
90
Support Request:
15
|
close stale | Bug report for snapcraft 2.26 describing a confusing error when organizing multiple source files to a non-directory destination. Filed in 2017 with no maintainer response or activity for over nine years. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
98
Complexity:
20
Confidence:
90
Support Request:
10
|
close stale | Reports a confusing error message in snapcraft 2.26 when organizing multiple source files to a destination without a trailing slash. Unaddressed for nearly a decade. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
98
Complexity:
15
Confidence:
90
Support Request:
10
|
close stale | Snapcraft's organize throws a confusing destination-already-exists error when copying multiple files to a path without a trailing slash. Unassigned and inactive for years. Fix: auto-treat destination as directory when matching multiple items. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1844801 Organize has different move behavior when using wildcard | snapcraft (launchpad) | open | Snapcraft organize keyword moves directory contents for literal paths but the directory itself for glob/wildcard paths, causing confusing 'already exists' errors. No maintainer response in 7 years; behavior still present in craft-parts organize code. Needs triage. | |
| #1794083 Updating build with organize can result in "destination path already exists" | snapcraft (launchpad) | closed | Closed without resolution. Snapcraft's automatic rebuild fails when organize globs map to the same directory twice, causing a path conflict. No fix or follow-up was documented. | |
| #553 Organize does not raise error if source file does not exist | craft-parts | open | craft-parts organize silently succeeds when a non-glob source file does not exist, so a renamed/missing file in a rockcraft.yaml organize mapping is not caught at build time. Maintainer confirmed root cause (empty glob iterator) in 2023; no fix landed. | |
| #1599709 organize feature deletes destination folder, is surprising | snapcraft (launchpad) | closed | Reported that snapcraft's organize feature deletes destination directories before moving files. Closed with zero comments, indicating the issue was abandoned without a fix or resolution. |