← Back to issue list

`rockcraft pack` with go-framework fails with `FileNotFoundError`

View original Github issue

Metadata

Project
rockcraft
Number
#813
Type
issue
State
open
Author
Aflynn50
Labels
Created
Updated
Closed

Current evaluation

rockcraft pack with go-framework extension fails with FileNotFoundError at staging when project has go.mod but no Go source files. Maintainer confirmed root cause (2026-02-26) and opened a PR to validate .go file presence and fail early; fix not yet merged.

Suggested action: keep open

Reason: Maintainer @gcomneno actively engaged on 2026-02-26, confirming the root cause (go.mod present but no Go source files causes the go plugin to produce no output, leading to the FileNotFoundError during staging) and stating they opened a PR to add early validation with a clearer error. The issue is triaged, valid, and has an in-flight fix, so it should remain open until the PR lands. The original reporter's repro also skipped the tutorial step of creating main.go, so the underlying UX gap (confusing low-level error) is real.

Impact: 45 Quick Win: 36.0 Staleness: 15 Complexity: 20 Confidence: 75 Support Request: 10

Issue body

### Bug Description When packing a go application with the experimental go framework, rockcraft fails with a `FileNotFoundError`. The full log is here: https://pastebin.canonical.com/p/xr627JZ8HQ/. ### To Reproduce Found following the build a rock for a Go application tutorial but without multi-pass: https://documentation.ubuntu.com/rockcraft/en/1.8.0/tutorial/go.html ``` go mod init example sudo snap install rockcraft --classic rockcraft init --profile go-framework ROCKCRAFT_ENABLE_EXPERIMENTAL_EXTENSIONS=True rockcraft pack ``` ### Environment OS: ubuntu@24.04 Rockcraft: 1.8.0 (latest/stable) Not running in multipass. ### rockcraft.yaml ```yaml name: my-rock-name # see https://documentation.ubuntu.com/rockcraft/en/1.8.0/explanation/bases/ # for more information about bases and using 'bare' bases for chiselled rocks base: bare # as an alternative, a ubuntu base can be used build-base: ubuntu@24.04 # build-base is required when the base is bare version: '0.1' # just for humans. Semantic versioning is recommended summary: A summary of your Go application # 79 char long summary description: | This is my-rock-name's description. You have a paragraph or two to tell the most important story about it. Keep it under 100 words though, we live in tweetspace and your description wants to look good in the container registries out there. # the platforms this rock should be built on and run on. # you can check your architecture with `dpkg --print-architecture` platforms: amd64: # arm64: # ppc64el: # s390x: # to ensure the go-framework extension functions properly, your Go project # should have a go.mod file. Check the parts section for the selection of # the default binary. # see https://documentation.ubuntu.com/rockcraft/en/1.8.0/reference/extensions/go-framework # for more information. # +-- my_rock_name # | |-- go.mod # | |-- migrate.sh extensions: - go-framework # uncomment the sections you need and adjust according to your requirements. # parts: # go-framework/install-app: # # select a specific Go version. Otherwise the current stable one will be used. # build-snaps: # - go/1.22/stable # organize: # # if the main package is in the base directory and the rockcraft name # # attribute is equal to the go module name, the name of the server will # # be selected correctly, otherwise you can adjust it. # # the file in /usr/local/bin/ with the name of the rockcraft project will be # # the binary to run your server. # # you can also include here other binary files to be included in the rock. # bin/otherbinary: usr/local/bin/projectname # go-framework/assets: # stage: # # by default, only the files migrate, migrate.sh, templates/ and static/ # # are copied into the image. You can modify the list below to override # # the default list and include or exclude specific files/directories # # in your project. # # note: Prefix each entry with "app/" followed by the local path. # - app/templates # - app/static # - app/otherdirectory # - app/otherfile ``` ### Relevant log output ```shell 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.338 Staging go-framework/install-app 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.338 execute action go-framework/install-app:Action(part_name='go-framework/install-app', step=Step.STAGE, action_type=ActionType.RUN, reason=None, project_vars=None, properties=ActionProperties(changed_files=None, changed_dirs=None)) 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.348 /root/parts/go-framework/install-app/install/usr: No such file or directory 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.348 Detailed information: FileNotFoundError: filename: '/root/parts/go-framework/install-app/install/usr' 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.359 Traceback (most recent call last): 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.359 File "/snap/rockcraft/3025/lib/python3.12/site-packages/craft_application/services/lifecycle.py", line 269, in run 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.359 aex.execute(action, stdout=stream, stderr=stream) 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.359 File "/snap/rockcraft/3025/lib/python3.12/site-packages/craft_parts/executor/executor.py", line 324, in execute 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.359 self._executor.execute(actions, stdout=stdout, stderr=stderr) 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.359 File "/snap/rockcraft/3025/lib/python3.12/site-packages/craft_parts/executor/executor.py", line 136, in execute 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.359 self._run_action(act, stdout=stdout, stderr=stderr) 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.359 File "/snap/rockcraft/3025/lib/python3.12/site-packages/craft_parts/executor/executor.py", line 211, in _run_action 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.359 handler.run_action(action, stdout=stdout, stderr=stderr) 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.359 File "/snap/rockcraft/3025/lib/python3.12/site-packages/craft_parts/executor/part_handler.py", line 171, in run_action 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.359 state = handler(step_info, stdout=stdout, stderr=stderr) 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.359 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.359 File "/snap/rockcraft/3025/lib/python3.12/site-packages/craft_parts/executor/part_handler.py", line 369, in _run_stage 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.359 contents = self._run_step( 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.360 ^^^^^^^^^^^^^^^ 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.360 File "/snap/rockcraft/3025/lib/python3.12/site-packages/craft_parts/executor/part_handler.py", line 493, in _run_step 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.360 return step_handler.run_builtin() 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.360 ^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.360 File "/snap/rockcraft/3025/lib/python3.12/site-packages/craft_parts/executor/step_handler.py", line 107, in run_builtin 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.360 return handler() 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.360 ^^^^^^^^^ 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.360 File "/snap/rockcraft/3025/lib/python3.12/site-packages/craft_parts/executor/step_handler.py", line 201, in _builtin_stage 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.360 files, dirs = migrate_files( 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.360 ^^^^^^^^^^^^^^ 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.360 File "/snap/rockcraft/3025/lib/python3.12/site-packages/craft_parts/executor/migration.py", line 77, in migrate_files 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.360 file_utils.create_similar_directory( 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.360 File "/snap/rockcraft/3025/lib/python3.12/site-packages/craft_parts/utils/file_utils.py", line 270, in create_similar_directory 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.360 stat = os.stat(source, follow_symlinks=False) 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.360 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-02-12 18:30:42.872 :: 2025-02-12 18:30:42.360 FileNotFoundError: [Errno 2] No such file or directory: '/root/parts/go-framework/install-app/install/usr' ```

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 45
Quick Win: 36.0
Staleness: 15
Complexity: 20
Confidence: 75
Support Request: 10
keep open rockcraft pack with go-framework extension fails with FileNotFoundError at staging when project has go.mod but no Go source files. Maintainer confirmed root cause (2026-02-26) and opened a PR to validate .go file presence and fail early; fix not yet merged.
qwen/qwen3.6-35b-a3b
Staleness: 25
Complexity: 20
Confidence: 85
Support Request: 0
keep open rockcraft pack with go-framework crashes with FileNotFoundError during staging when no Go source files are present. A maintainer opened a PR to validate .go files and fail early, but the issue remains open awaiting merge/verification.
qwen3.6-35b-a3b-mtp-q6
Staleness: 40
Complexity: 20
Confidence: 85
Support Request: 10
keep open Rockcraft pack with go-framework crashes with FileNotFoundError when building a project with go.mod but no source files. Maintainer diagnosed the issue and opened a PR to add early validation and a clearer error message.
qwen3.6-35b-a3b-mtp-q6
Staleness: 40
Complexity: 25
Confidence: 90
Support Request: 0
keep open rockcraft pack with go-framework crashes with FileNotFoundError when a project has go.mod but no Go source files. A PR was opened to validate .go files and fail early with a clearer error, awaiting merge/verification.
qwen3.6-35b-a3b-mtp-q6
Staleness: 60
Complexity: 20
Confidence: 85
Support Request: 10
keep open rockcraft pack with the go-framework extension throws FileNotFoundError when a project has go.mod but lacks Go source files. A PR adds early validation and a clearer error message, currently awaiting review.

Update history

No update history recorded yet.

Related issues

No related issues found above the similarity threshold.