dagger/dagger · error
failed to get configured module: %w
Error message
failed to get configured module: %w
What it means
initializeModule first checks whether the target module's config exists via ModuleSource.ConfigExists inside a 'finding module configuration' telemetry span. If that engine query errors (as opposed to returning exists=false, which yields errModuleNotFound), the error is wrapped as 'failed to get configured module'. It means the CLI could not determine the module's configuration state, typically due to engine/transport problems.
Source
Thrown at internal/cmd/dagger/module_inspect.go:86
// initializeModule loads the module at the given source ref
//
// Returns an error if the module is not found or invalid.
func initializeModule(
ctx context.Context,
dag *dagger.Client,
modRef string,
modSrc *dagger.ModuleSource,
opts ...initModuleOpts,
) (rdef *moduleDef, rerr error) {
ctx, span := Tracer().Start(ctx, "load module: "+modRef)
defer telemetry.EndWithCause(span, &rerr)
findCtx, findSpan := Tracer().Start(ctx, "finding module configuration", telemetry.Encapsulate())
configExists, err := modSrc.ConfigExists(findCtx)
telemetry.EndWithCause(findSpan, &err)
if err != nil {
return nil, fmt.Errorf("failed to get configured module: %w", err)
}
if !configExists {
return nil, errModuleNotFound
}
serveCtx, serveSpan := Tracer().Start(ctx, "initializing module", telemetry.Encapsulate())
serveOpts := dagger.ModuleServeOpts{IncludeDependencies: true}
for _, o := range opts {
if o.entrypoint {
serveOpts.Entrypoint = true
}
if o.skipDependencies {
serveOpts.IncludeDependencies = false
}
}
err = modSrc.AsModule().Serve(serveCtx, serveOpts)
telemetry.EndWithCause(serveSpan, &err)
if err != nil {View on GitHub (pinned to 82ba2681db)
Solutions
- Confirm engine health with a trivial command (`dagger core version`) and retry.
- Inspect the wrapped `%w` cause for the specific transport/ref-resolution error and address it (network, auth, timeout).
- For remote module refs, verify network access and git credentials for the host.
- If local, ensure the path/ref is valid and the engine session is fresh (re-run the command).
Example fix
// before: stale session $ dagger functions # failed to get configured module: connection closed // after: restart the session/engine and retry $ dagger core version && dagger functions
Defensive patterns
Strategy: retry
Validate before calling
// cheap connectivity probe before module inspection
if err := exec.Command("dagger", "core", "version").Run(); err != nil {
return fmt.Errorf("engine unreachable, skip inspection: %w", err)
} Try / catch
exists, err := modSrc.ConfigExists(ctx)
if err != nil {
if ctx.Err() != nil { return ctx.Err() } // caller cancellation, don't retry
return fmt.Errorf("failed to get configured module: %w", err) // retry with backoff on transient transport errors
} Prevention
- Probe engine health before inspection-heavy flows
- Set generous context deadlines for remote module inspection
- Verify git credentials for private remote module refs
- Distinguish this transport failure from errModuleNotFound (exists=false) when handling
When it happens
Trigger: Any inspect-time call into initializeModule (inspectSDKInitFunction, CLI module inspection) where ConfigExists fails: dropped engine connection, session timeout, GraphQL request rejected, or errors resolving a remote module ref (network/auth for git-hosted modules).
Common situations: Engine session died between connect and inspect; inspecting a remote module over a flaky network; invalid credentials for private git-hosted module sources; context deadline exceeded on slow engines.
Related errors
- load module %q: %w
- set engine version: %w
- list installed modules: %w
- unknown sdk language
- merge module types into schema: %w
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/b9180860a1e838e7.
Report an issue: GitHub.