{"record":{"id":"b9180860a1e838e7","repo":"dagger/dagger","slug":"failed-to-get-configured-module-w-b91808","errorCode":null,"errorMessage":"failed to get configured module: %w","messagePattern":"failed to get configured module: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/dagger/module_inspect.go","lineNumber":86,"sourceCode":"// initializeModule loads the module at the given source ref\n//\n// Returns an error if the module is not found or invalid.\nfunc initializeModule(\n\tctx context.Context,\n\tdag *dagger.Client,\n\tmodRef string,\n\tmodSrc *dagger.ModuleSource,\n\topts ...initModuleOpts,\n) (rdef *moduleDef, rerr error) {\n\tctx, span := Tracer().Start(ctx, \"load module: \"+modRef)\n\tdefer telemetry.EndWithCause(span, &rerr)\n\n\tfindCtx, findSpan := Tracer().Start(ctx, \"finding module configuration\", telemetry.Encapsulate())\n\tconfigExists, err := modSrc.ConfigExists(findCtx)\n\ttelemetry.EndWithCause(findSpan, &err)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get configured module: %w\", err)\n\t}\n\tif !configExists {\n\t\treturn nil, errModuleNotFound\n\t}\n\n\tserveCtx, serveSpan := Tracer().Start(ctx, \"initializing module\", telemetry.Encapsulate())\n\tserveOpts := dagger.ModuleServeOpts{IncludeDependencies: true}\n\tfor _, o := range opts {\n\t\tif o.entrypoint {\n\t\t\tserveOpts.Entrypoint = true\n\t\t}\n\t\tif o.skipDependencies {\n\t\t\tserveOpts.IncludeDependencies = false\n\t\t}\n\t}\n\terr = modSrc.AsModule().Serve(serveCtx, serveOpts)\n\ttelemetry.EndWithCause(serveSpan, &err)\n\tif err != nil {","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/internal/cmd/dagger/module_inspect.go#L68-L104","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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)."],"exampleFix":"// before: stale session\n$ dagger functions  # failed to get configured module: connection closed\n// after: restart the session/engine and retry\n$ dagger core version && dagger functions","handlingStrategy":"retry","validationCode":"// cheap connectivity probe before module inspection\nif err := exec.Command(\"dagger\", \"core\", \"version\").Run(); err != nil {\n    return fmt.Errorf(\"engine unreachable, skip inspection: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"exists, err := modSrc.ConfigExists(ctx)\nif err != nil {\n    if ctx.Err() != nil { return ctx.Err() } // caller cancellation, don't retry\n    return fmt.Errorf(\"failed to get configured module: %w\", err) // retry with backoff on transient transport errors\n}","preventionTips":["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"],"tags":["cli","engine-connectivity","graphql","module-inspection"],"backgroundTag":"module-config-lookup-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"}