dagger/dagger · error
module config is required
Error message
module config is required
What it means
legacyModuleConfigAsCurrent requires a non-nil *modules.ModuleConfig to convert a legacy module config into the current serialization format. This error means the conversion was invoked with a nil config pointer.
Source
Thrown at core/schema/workspace_migrate_module_config.go:84
if len(conversions) == 0 {
return nil, nil
}
return conversions, nil
}
// workspaceMigrationLeavesModuleLegacy reports whether migration leaves this
// module's config in legacy format: a discovered nested workspace (own
// toolchains/blueprint) is neither converted in place nor routed through
// PlanMigration.
func workspaceMigrationLeavesModuleLegacy(compatWorkspace *workspace.CompatWorkspace) bool {
return compatWorkspace.DiscoveredLocalModule &&
workspace.HasOwnWorkspaceSemantics(compatWorkspace.Config)
}
func legacyModuleConfigAsCurrent(cfg *modules.ModuleConfig) ([]byte, error) {
if cfg == nil {
return nil, fmt.Errorf("module config is required")
}
cloned := *cfg
if cloned.Source == "." {
cloned.Source = ""
}
return modules.MarshalModuleConfigForFormat(&modules.ModuleConfigWithUserFields{
ModuleConfig: cloned,
}, modules.ConfigFormatCurrent)
}
View on GitHub (pinned to 82ba2681db)
Solutions
- Ensure compatWorkspace.Config is loaded (non-nil) before the conversion step
- Re-run legacy config loading and propagate any load error instead of continuing with nil
- Fix the source legacy config file so it parses into a ModuleConfig
Example fix
// before
if compat.Config == nil { /* conversion still attempted */ }
// after
if compat.Config == nil {
return nil, fmt.Errorf("config %s not loaded", compat.ConfigPath)
} Defensive patterns
Strategy: type-guard
Validate before calling
if cfg == nil {
return fmt.Errorf("refusing conversion: module config is nil")
} Type guard
func isModuleConfig(cfg *modules.ModuleConfig) bool { return cfg != nil } Try / catch
data, err := legacyModuleConfigAsCurrent(cfg)
if err != nil {
if strings.Contains(err.Error(), "module config is required") {
return fmt.Errorf("reload the legacy config; got nil: %w", err)
}
return err
} Prevention
- Check Config != nil immediately after loading the compat workspace
- Never construct CompatWorkspace values without a loaded Config
- Treat nil Config from a loader as a hard error, not a skip
When it happens
Trigger: workspaceMigrationModuleConfigConversions processing a compat workspace whose Config field is nil (config was never loaded or failed to load silently).
Common situations: Legacy config file missing or unparseable so loading produced a nil config; partially constructed CompatWorkspace in tooling; test fixtures omitting Config.
Related errors
- %s uses runtime instead of sdk
- legacy module config project root is required
- converting legacy module config %s: %w
- encode persisted generator: nil generator
- encode persisted generator group: nil generator group
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/6c88cba9521370b5.
Report an issue: GitHub.