{"record":{"id":"6c88cba9521370b5","repo":"dagger/dagger","slug":"module-config-is-required","errorCode":null,"errorMessage":"module config is required","messagePattern":"module config is required","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/schema/workspace_migrate_module_config.go","lineNumber":84,"sourceCode":"\n\tif len(conversions) == 0 {\n\t\treturn nil, nil\n\t}\n\treturn conversions, nil\n}\n\n// workspaceMigrationLeavesModuleLegacy reports whether migration leaves this\n// module's config in legacy format: a discovered nested workspace (own\n// toolchains/blueprint) is neither converted in place nor routed through\n// PlanMigration.\nfunc workspaceMigrationLeavesModuleLegacy(compatWorkspace *workspace.CompatWorkspace) bool {\n\treturn compatWorkspace.DiscoveredLocalModule &&\n\t\tworkspace.HasOwnWorkspaceSemantics(compatWorkspace.Config)\n}\n\nfunc legacyModuleConfigAsCurrent(cfg *modules.ModuleConfig) ([]byte, error) {\n\tif cfg == nil {\n\t\treturn nil, fmt.Errorf(\"module config is required\")\n\t}\n\tcloned := *cfg\n\tif cloned.Source == \".\" {\n\t\tcloned.Source = \"\"\n\t}\n\treturn modules.MarshalModuleConfigForFormat(&modules.ModuleConfigWithUserFields{\n\t\tModuleConfig: cloned,\n\t}, modules.ConfigFormatCurrent)\n}\n","sourceCodeStart":66,"sourceCodeEnd":94,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/schema/workspace_migrate_module_config.go#L66-L94","documentation":"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.","triggerScenarios":"workspaceMigrationModuleConfigConversions processing a compat workspace whose Config field is nil (config was never loaded or failed to load silently).","commonSituations":"Legacy config file missing or unparseable so loading produced a nil config; partially constructed CompatWorkspace in tooling; test fixtures omitting Config.","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"],"exampleFix":"// before\nif compat.Config == nil { /* conversion still attempted */ }\n// after\nif compat.Config == nil {\n    return nil, fmt.Errorf(\"config %s not loaded\", compat.ConfigPath)\n}","handlingStrategy":"type-guard","validationCode":"if cfg == nil {\n    return fmt.Errorf(\"refusing conversion: module config is nil\")\n}","typeGuard":"func isModuleConfig(cfg *modules.ModuleConfig) bool { return cfg != nil }","tryCatchPattern":"data, err := legacyModuleConfigAsCurrent(cfg)\nif err != nil {\n    if strings.Contains(err.Error(), \"module config is required\") {\n        return fmt.Errorf(\"reload the legacy config; got nil: %w\", err)\n    }\n    return err\n}","preventionTips":["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"],"tags":["migration","module-config","nil-check"],"backgroundTag":"missing-configuration","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"}