`snapcraft init` fails when the working directory's name is longer than 40 characters
Metadata
Current evaluation
Fixed by merged PR canonical/snapcraft#6216 (commit 254546337): snapcraft init now uses the default snap name when a directory-derived name exceeds 40 characters.
Resolution: closed resolved
Reason: PR #6216 was merged in commit 254546337. It makes initialization tolerate overlong directory-derived names while preserving validation for explicitly supplied names.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Check existing issues
- [x] I've verified that this bug isn't described by any existing issues.
### Bug description
Project initialization command should still work even when the name of the working directory is longer than usual.
### Steps to reproduce
```bash
mkdir this-working-directory-has-a-very-long-name
cd this-working-directory-has-a-very-long-name
snapcraft init
```
### Current behavior
```text
$ snapcraft init
Invalid snap name 'this-working-directory-has-a-very-long-name': snap names must be 40 characters or less.
Recommended resolution: Provide a valid name with '--name' or rename the project directory.
Full execution log: '/home/brlin/.local/state/snapcraft/log/snapcraft-20260312-211208.774528.log'
```
### Environment
**OS:** Ubuntu 25.10
**Snapcraft:** 8.14.0.post68 (17232)
**Locale:** zh\_TW.UTF-8
### snapcraft.yaml
```yaml
# N/A
```
### Log output
```shell
N/A
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR canonical/snapcraft#6216 (commit 254546337): snapcraft init now uses the default snap name when a directory-derived name exceeds 40 characters. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR #6216 (commit 254546337): snapcraft init now permits directory-derived names longer than 40 characters while still rejecting invalid explicit names. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed. Resolved by updating snapcraft init to bypass automatic directory name validation for paths exceeding 40 characters, allowing successful project initialization. | |
| qwen/qwen3.8-27b |
Impact:
35
Quick Win:
26
Staleness:
45
Complexity:
25
Confidence:
80
Support Request:
10
|
keep open | snapcraft init fails when the working directory name exceeds 40 characters; PR #6216 (open, pending review) adds a fallback to a default project name for long directory names. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
75
Complexity:
20
Confidence:
85
Support Request:
5
|
needs triage | snapcraft init fails when the working directory name exceeds 40 characters. Unlabeled, no maintainer comments, inactive for 131 days. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
75
Complexity:
20
Confidence:
85
Support Request:
0
|
needs triage | snapcraft init fails when the current working directory name exceeds 40 characters, as it incorrectly uses the directory name as the snap name. Unlabeled, no maintainer response, inactive for 117 days. |
Update history
| Date | Change |
|---|---|
| closed |
Related work
-
Likely Fixed By:
canonical/snapcraft#6216
(confidence 100%)
Merged fix titled "fix(init): allow long directory names".
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #6216 fix(init): allow long directory names | snapcraft | merged | Merged #6216 (commit 254546337), fixing snapcraft init to use a valid default for invalid directory-derived names while preserving validation of explicit names; closes #6093. | |
| #1590620 snapcraft can generage snaps with a name longer than 107 characters | snapcraft (launchpad) | open | Snapcraft still accepts overlong snap names during project validation, allowing builds that the Store later rejects; the maintainer discussed shorter limits, but global enforcement is absent. |