← Back to issue list

snap build fails if go must download the version

View original Github issue

Metadata

Project
craft-parts
Number
#1447
Type
issue
State
open
Author
adombeck
Labels
—
Created
Updated
Closed
—

Current evaluation

Go plugin validation misreads a toolchain-download message from stderr as the compiler version, so the first clean snapcraft pack fails while retries succeed; it remains unfixed and untriaged.

Suggested action: needs triage

Reason: The current validator still returns proc.stderr whenever non-empty, and Go validation rejects any result not starting with "go version", confirming the reported root cause. The authd command, part YAML, first-run failure, and retry workaround make it reproducible, while current unit fixtures cover only stdout; no fix or maintainer triage is present and the only comment requests assignment.

Evaluated by: mr-cal-bot

Impact: 48 Quick Win: 31 Complexity: 30 Confidence: 96 Actionability: 92

Issue body

### Bug Description I see `snapcraft pack` fail with: ``` Environment validation failed for part 'semver': invalid go compiler version 'go: downloading go1.25.6 (linux/amd64)'. Failed to run snapcraft in instance ``` It works when I execute `snapcraft pack` again. I assume that's because the required Go version was then already downloaded on the instance. I took a quick look at the code where this error originates from. [This](https://github.com/canonical/craft-parts//blob/71291d50ec95aed813215e89463866dd09aaaa5e/craft_parts/plugins/go_plugin.py#L66-L71) is the call to `go version` which calls `subprocess.run` and [returns the stderr](https://github.com/canonical/craft-parts//blob/71291d50ec95aed813215e89463866dd09aaaa5e/craft_parts/plugins/validator.py#L145-L152) it it's non-empty, which it then assumes is the go version. It should use the output on stdout instead. ### To Reproduce I encounter this when trying to build the authd snaps: ```bash git clone https://github.com/canonical/authd cd authd # Prepare snapcraft.yaml ./scripts/prepare-broker-variant-files # Build the snap snapcraft pack ``` ### part yaml ```yaml semver: source: authd-oidc-brokers/tools source-type: local plugin: go override-build: | go mod download all go mod vendor go build -o ${GOBIN}/semver semver/semver.go ``` ### Relevant log output I assume the above is enough to understand the issue. Let me know if you do need logs.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 48
Quick Win: 31
Complexity: 30
Confidence: 96
Actionability: 92
needs triage Go plugin validation misreads a toolchain-download message from stderr as the compiler version, so the first clean snapcraft pack fails while retries succeed; it remains unfixed and untriaged.
stealth/space-bunny-alpha
Impact: 58
Quick Win: 33
Complexity: 30
Confidence: 84
Actionability: 82
needs triage snapcraft pack fails for the go plugin when `go version` must first download a toolchain: validator._execute returns stderr when non-empty, so "go: downloading go1.25.6" is mistaken for the version. Unfixed; contributor asked to be assigned.
qwen/qwen3.6-35b-a3b
Impact: 60
Quick Win: 38
Complexity: 20
Confidence: 85
Actionability: 80
keep open Go plugin environment validation fails when Go downloads a version, because stderr download message is returned instead of stdout version output
qwen/qwen3.8-27b
Impact: 55
Quick Win: 41
Staleness: 15
Complexity: 25
Confidence: 80
Support Request: 5
keep open Go plugin env validation in craft-parts fails when `go version` triggers a toolchain auto-download, because validator._execute returns stderr ('go: downloading go1.25.6...') instead of stdout. Bug confirmed present in current code; a contributor requested assignment 8 days ago.
qwen/qwen3.8-27b
Impact: 45
Quick Win: 29
Staleness: 20
Complexity: 35
Confidence: 85
Support Request: 5
needs triage Go plugin environment validation fails on first build when go auto-downloads a toolchain, because validator._execute returns stderr ('go: downloading go1.25.6...') instead of stdout. Bug confirmed still present in current code; contributor volunteered 8 days ago, no labels or maintainer response yet.
qwen/qwen3.8-27b
Impact: 45
Quick Win: 29
Staleness: 25
Complexity: 35
Confidence: 85
Support Request: 5
needs triage snapcraft pack fails on first run of a go part when go auto-downloads a toolchain: the validator reads stderr of `go version` and misreads the 'go: downloading...' message as the version. Bug still present in craft-parts; a contributor asked to be assigned 8 days ago.
qwen/qwen3.6-35b-a3b
Staleness: 70
Complexity: 10
Confidence: 90
Support Request: 0
needs triage Go plugin incorrectly reads stderr instead of stdout when checking Go version, causing snapcraft pack to fail during version downloads. Untriaged and awaiting maintainer review.
qwen3.6-35b-a3b-mtp-q6
Staleness: 45
Complexity: 15
Confidence: 85
Support Request: 0
needs triage Bug in craft-parts Go plugin where go version reads stderr instead of stdout, causing failures when Go needs to download a version. A contributor recently volunteered to fix it.

Update history

Date Change
updated

Related work

  • Duplicate Of: rockcraft#902 (confidence 98%)

    Open downstream report of the same toolchain-download stderr validation failure that explicitly identifies craft-parts#1447 as the duplicate and root-cause issue.

Related issues

Issue Project State Summary Similarity
#902 Go plugin environment validation fails if toolchain downloads a new version rockcraft open Go plugin env validation fails when `go version` triggers toolchain auto-download; stderr download message is parsed as the version. Root cause is in craft-parts validator; duplicate craft-parts#1447 is open.
74%