{"record":{"id":"ae1d5cdaff17b2d7","repo":"dagger/dagger","slug":"get-module-source-subpath-w","errorCode":null,"errorMessage":"get module source subpath: %w","messagePattern":"get module source subpath: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdk/python/runtime/discovery.go","lineNumber":210,"sourceCode":"\t\tif err := task(ctx, m); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// loadModInfo loads the module's metadata.\nfunc (d *Discovery) loadModInfo(ctx context.Context, m *PythonSdk) error {\n\teg, gctx := errgroup.WithContext(ctx)\n\n\tdoneSubPath := make(chan struct{})\n\n\teg.Go(func() error {\n\t\tdefer close(doneSubPath)\n\t\tp, err := m.ModSource.SourceSubpath(gctx)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"get module source subpath: %w\", err)\n\t\t}\n\t\td.mu.Lock()\n\t\tm.SubPath = p\n\t\td.mu.Unlock()\n\t\treturn nil\n\t})\n\n\teg.Go(func() error {\n\t\t// m.Source() depends on SubPath\n\t\t<-doneSubPath\n\t\tentries, _ := m.Source().Entries(gctx)\n\t\td.mu.Lock()\n\t\tfor _, entry := range entries {\n\t\t\td.FileSet[entry] = struct{}{}\n\t\t}\n\t\td.mu.Unlock()\n\t\treturn nil\n\t})","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/sdk/python/runtime/discovery.go#L192-L228","documentation":"During Python module discovery, a goroutine/errgroup step calls ModSource.SourceSubpath() to learn the module's configured subpath inside its source directory. Failures (connection to the engine, invalid source, engine error) are wrapped as 'get module source subpath' and cancel the whole errgroup.","triggerScenarios":"dagger develop / module load on a Python module whose SourceSubpath query fails — typically an engine communication failure, a deleted source directory, or a dagger.json subpath pointing outside the source root.","commonSituations":"Source directory moved or deleted after the client was created; module configured with an invalid subpath in dagger.json; engine connection dropped mid-discovery.","solutions":["Read the wrapped inner error for the root cause (e.g. file not found vs RPC failure).","Verify the module source directory exists and dagger.json's subpath is valid and inside it.","Re-run from the module root with a fresh engine session.","If using custom subpath config, correct it with `dagger init` or by editing dagger.json."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# Shell: confirm the source dir and dagger.json subpath are sane before running\ntest -d \"${MODULE_SOURCE:-.}\" && test -f dagger.json || { echo \"missing module source/dagger.json\"; exit 1; }","typeGuard":null,"tryCatchPattern":"if err := dagger.Develop(ctx); err != nil {\n    if strings.Contains(err.Error(), \"get module source subpath\") {\n        return fmt.Errorf(\"check module source dir and dagger.json subpath: %w\", err)\n    }\n    return err\n}","preventionTips":["Keep the module source directory intact for the lifetime of the session","Verify dagger.json subpath is inside the source root","Re-run discovery after moving source directories"],"tags":["go","python-sdk","module-source","subpath"],"backgroundTag":"module-source-discovery-failed","analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}