#Filesync error with nested client running `dagger develop`

1 messages · Page 1 of 1 (latest)

magic willow
#

When executing dagger develop using ExperimentalPrivilegedNesting I get the following error:

failed to get content hash: failed to get directory: failed to get snapshot: failed to snapshot: failed to receive stat message: rpc error: code = NotFound desc = get full root path: rpc error: code = NotFound desc = eval symlinks: lstat /src: no such file or directory

This does not cause the execution to fail, and the generated files are present in the returned directory.

This can be reproduced using this example (0.19.3):

package main

import (
    "context"
    "dagger/test/internal/dagger"
)

type Test struct {
    Src *dagger.Directory
}

func New(src *dagger.Directory) *Test {
    return &Test{Src: src}
}

func (m *Test) Codegen(ctx context.Context) (*dagger.Directory, error) {
    dcli, err := daggerCLI(ctx)
    if err != nil {
        return nil, err
    }

    dcliSrc := dcli.
        WithDirectory("/src", m.Src).
        WithWorkdir("/src")

    return dcliSrc.
        WithExec([]string{"dagger", "develop"}, dagger.ContainerWithExecOpts{ExperimentalPrivilegedNesting: true}).
        Directory("."), nil
}

func daggerCLI(ctx context.Context) (*dagger.Container, error) {
    ver, err := dag.Version(ctx)
    if err != nil {
        return nil, err
    }

    return dag.Container().From("alpine:3.22").
        WithEnvVariable("DAGGER_VERSION", ver).
        WithExec([]string{"apk", "add", "curl", "git"}).
        WithExec([]string{
            "sh",
            "-o",
            "pipefail",
            "-exc",
            `curl -fsSL https://dl.dagger.io/dagger/install.sh | BIN_DIR=/usr/local/bin sh`}), nil
}
#

Trace: https://dagger.cloud/nine/traces/c277b02b2f722f160d64a8966aa44391?listen=41d1a692ba902e0a&listen=454cbc397a4c4b95#454cbc397a4c4b95:L11

Note: In the TUI output there is duplication of the outputs, i.e. "gogo" & "/src/src", but not in the trace view in Dagger Cloud.

│   │ ╰╴▼ Host.directory(path: "/src", include: [".env"]): Directory! = xxh3:39ebc5259a815547 0.0s ERROR
│   │   ! failed to get content hash: failed to get directory: failed to get snapshot: failed to snapshot: failed to receive stat message: rpc error: code = NotFound desc = get full root path: rpc error: code =
│   │     NotFound desc = eval symlinks: lstat /src: no such file or directory
│   │   ╰╴✘ filesync 0.0s ERROR
│   │     ! failed to receive stat message: rpc error: code = NotFound desc = get full root path: rpc error: code = NotFound desc = eval symlinks: lstat /src: no such file or directory
│   ├╴▼ .localContextDirectoryPath: String! = xxh3:26ea0d1364573e73 0.0s
│   │ ┃ /src/src
│   │
│   ├╴▼ ModuleSource.sourceRootSubpath: String! = xxh3:8aea66c16ce82afc 0.0s
│   │ ┃ ..
│   │
│   ╰╴▼ develop 0.6s
│     ╰╴▼ develop . 0.6s
│       ├╴✔ ModuleSource.withEngineVersion(version: "latest"): ModuleSource! = xxh3:3b5e900938b42fb1 0.0s
│       ├╴✔ .sdk: SDKConfig = xxh3:768dfe869f76f8ec 0.0s
│       ├╴▼ .source: String! = xxh3:3a31eacfbb4c95f5 0.0s
│       │ ┃ gogo
│       │
│       ├╴▼ ModuleSource@xxh3:736cc7375b3fea3f.sourceSubpath: String! = xxh3:3be1679915d9c07f 0.0s
│       │ ┃ ..
│       │
│       ├╴✔ ModuleSource@xxh3:736cc7375b3fea3f.configClients: [ModuleConfigClient!]! = xxh3:ce91bb51f7792bef 0.0s
│       │
│       ├╴▼ ModuleSource@xxh3:736cc7375b3fea3f.localContextDirectoryPath: String! = xxh3:bb2876143af0e6c7 0.0s
│       │ ┃ /src/src

This issue seems like it could be related, but I'm not sure: https://github.com/dagger/dagger/issues/8154

tame plume
# magic willow Trace: https://dagger.cloud/nine/traces/c277b02b2f722f160d64a8966aa44391?listen=...

Thanks, can repro (dagger call -m github.com/sipsma/dagger/tmp@nested-module-load-error --src https://github.com/dagger/dagger codegen for anyone trying to repro)

Definitely something going wrong there, will try to figure it out.

If you are looking for a workaround in the meantime, you could likely reimplement your Codegen function to be just:

func (m *Test) Codegen(ctx context.Context) *dagger.Directory {
    return m.Src.AsModuleSource().GeneratedContextDirectory()
}

which is essentially how dagger develop works (it just relies on those core API calls). It seems to avoid the error you are hitting