← Back to issue list

Misleading 'unable to determine source type' error when packing from inside the snap/ directory

View original Github issue

Metadata

Project
snapcraft
Number
#6501
Type
issue
State
open
Author
LoweRAM
Labels
Status: Triaged Type: Bug
Created
Updated
Closed
—

Current evaluation

Misleading 'unable to determine source type' error when running snapcraft from inside the snap/ directory; path resolution is relative to CWD, not snapcraft.yaml location.

Suggested action: keep open

Reason: Valid, triaged bug with a clear reproducer and explicit description of expected behavior. The root cause is in craft-parts' `get_source_type_from_uri()` which raises `InvalidSourceType` when `Path(source).is_dir()` returns False (path doesn't exist), rather than a clearer 'path not found' error. The fix requires changes in craft-parts to check path existence before raising this error, or in snapcraft to provide better context. Related to #5721 which has the same error message from a different cause.

Evaluated by: mr-cal-bot

Impact: 40 Quick Win: 22 Complexity: 30 Confidence: 80 Actionability: 80

Issue body

## Bug description `source` paths resolve against the directory Snapcraft is invoked from, not the location of `snapcraft.yaml`. Packing from inside `snap/` when the yaml lives there causes the relative paths to resolve incorrectly, and the resulting error names the wrong problem: ``` Failed to pull source: unable to determine source type of 'snap/local'. ``` `source` types are fine here — `snap/local` is a perfectly valid local source. The error should say the path was not found, ideally naming the absolute path that was searched. As written it sends the reader looking for a source-type problem that doesn't exist. See also #5721 for the same message arising from a different cause. ## Steps to reproduce Repository: `juju/juju`, branch `3.6`, commit `cd60f5a`. 1. `git clone --depth 1 --branch 3.6 https://github.com/juju/juju.git && cd juju` 2. `cd snap && snapcraft pack --use-lxd` — fails with the error above 3. `cd .. && snapcraft pack --use-lxd` — succeeds, pulls all parts Identical command and checkout; only the working directory differs. The same layout is used by Snapcraft's own `snap/snapcraft.yaml` and by snapd's `build-aux/snap/snapcraft.yaml`, so this is a reasonably common convention to hit. ## Environment - Snapcraft 9.2.0 (`snapcraft_c`), craft-parts 2.37.2 - LXD build provider, not destructive mode - Ubuntu 26.10, x86_64 ## snapcraft.yaml Relevant parts from `snap/snapcraft.yaml` in the repo above: ```yaml parts: wrappers: plugin: dump source: snap/local jujud: plugin: nil source: . ``` ## Log output ``` Launching managed ubuntu 24.04 instance... Creating instance from base instance Starting instance Initializing lifecycle Failed to pull source: unable to determine source type of 'snap/local'. Failed to run snapcraft in instance Full execution log: '/home/user/.local/state/snapcraft/log/snapcraft-20261015-105925.309457.log' ```

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b
Impact: 40
Quick Win: 22
Complexity: 30
Confidence: 80
Actionability: 80
keep open Misleading 'unable to determine source type' error when running snapcraft from inside the snap/ directory; path resolution is relative to CWD, not snapcraft.yaml location.

Update history

Date Change
created

Related work

  • Related To: snapcraft#5721 (confidence 90%)

    Same misleading error message but caused by a different issue (path mismatch for ROS 2 extensions).

Related issues

No related issues found above the similarity threshold.