Skip to content

Build fails with "file name too long" error when task label contains long ldflags #5216

@AkagiYui

Description

@AkagiYui

Description

When building a Wails v3 project with wails3 build, the build fails with a "file name too long" error. This occurs because the embedded Task (forked from go-task/task) generates checksum filenames based on task labels, and when labels contain long content (such as complete ldflags with build metadata), the filename exceeds the filesystem's 255 character limit on macOS.

The issue originates from the generate:bindings task in the default Taskfile.yml which uses a label that can include lengthy BUILD_FLAGS containing ldflags for injecting version information.

To Reproduce

  1. Create a new Wails v3 project using the default template
  2. In the root Taskfile.yml, define build variables with ldflags for version injection:
    vars:
      BUILD_HASH:
        sh: git rev-parse HEAD 2>/dev/null || echo "dev"
      BUILD_TIME:
        sh: date -u +"%Y-%m-%dT%H:%M:%SZ"
  3. Run wails3 build
  4. See error:
    ERROR   task: Failed to run task "darwin:build": open /path/to/project/.task/checksum/generate-bindings--BUILD_FLAGS--tags-production--trimpath--buildvcs-false--ldflags---w--s--X-foo-bar-internal-config-BuildHash-...: file name too long
    

Expected behaviour

The build should complete successfully without filesystem errors. Task should handle long labels gracefully, such as:

  • Using a hash (e.g., SHA256) of the label as the checksum filename
  • Truncating long filenames while ensuring uniqueness
  • Documenting any label length limitations

Screenshots

N/A (terminal error)

Attempted Fixes

  1. Searched for "wails3 build file name too long" - no relevant results
  2. Searched for "task checksum filename too long" - found this is a known limitation in go-task/task
  3. Discovered Wails uses a forked version of Task: https://github.com/wailsapp/task
  4. Deleted .task directory and rebuilt - error persists because the label is still too long
  5. Workaround: Modified the task label in Taskfile.yml to not include full BUILD_FLAGS:
    # Before (causes error):
    label: 'generate:bindings (BUILD_FLAGS={{.BUILD_FLAGS}})'
    
    # After (works):
    label: 'generate:bindings ({{if eq .DEV "true"}}dev{{else}}production{{end}})'
    This workaround succeeds but loses specificity in task identification.

System Details

Wails (v3.0.0-alpha.78)  Wails Doctor 
                                                                                                                                                  
# System 

┌──────────────────────────────────────────────────┐
| Name          | MacOS                            |
| Version       | 15.7.2                           |
| ID            | 24G325                           |
| Branding      | Sequoia                          |
| Platform      | darwin                           |
| Architecture  | arm64                            |
| Apple Silicon | true                             |
| CPU           | Apple M4                         |
| CPU 1         | Apple M4                         |
| CPU 2         | Apple M4                         |
| GPU           | 10 cores, Metal Support: Metal 3 |
| Memory        | 16 GB                            |
└──────────────────────────────────────────────────┘

# Build Environment 

┌──────────────────────────────────────────────────────────────────────┐
| Wails CLI      | v3.0.0-alpha.78                                     |
| Go Version     | go1.26.1                                            |
| -buildmode     | exe                                                 |
| -compiler      | gc                                                  |
| CGO_CFLAGS     |                                                     |
| CGO_CPPFLAGS   |                                                     |
| CGO_CXXFLAGS   |                                                     |
| CGO_ENABLED    | 1                                                   |
| CGO_LDFLAGS    |                                                     |
| DefaultGODEBUG | cryptocustomrand=1,tlssecpmlkem=0,urlstrictcolons=0 |
| GOARCH         | arm64                                               |
| GOARM64        | v8.0                                                |
| GOOS           | darwin                                              |
└──────────────────────────────────────────────────────────────────────┘

# Dependencies 

┌──────────────────────────────────────────────────────────────────────────────┐
| *NSIS           | Not Installed. Install with `brew install makensis`.       |
| Xcode cli tools | 2410                                                       |
| npm             | 11.12.1                                                    |
| docker          | *Docker version 28.2.2, build e6534b4 (daemon not running) |
|                                                                              |
└────────────────────────── * - Optional Dependency ───────────────────────────┘

# Checking for issues 

 SUCCESS  No issues found

# Diagnosis 

 SUCCESS  Your system is ready for Wails development!

Need documentation? Run: wails3 docs
 ♥   If Wails is useful to you or your company, please consider sponsoring the project: wails3 sponsor

Additional context

  • This is fundamentally an issue in the Task library, but since Wails embeds a forked version (wailsapp/task), it affects Wails users directly
  • The issue is particularly problematic for Go projects that use ldflags to inject build-time variables, which is a common pattern
  • A potential fix in the forked Task: if label length exceeds a threshold (e.g., 200 chars), use hash(label) + ".checksum" as the filename
  • Related upstream issue would be filed to go-task/task, but since Wails uses its own fork, fixing it there would benefit Wails users immediately

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingMacOSgoPull requests that update Go codev3

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions