{"record":{"id":"eedc7654b75e1956","repo":"caddyserver/caddy","slug":"loading-log-core-module-v","errorCode":null,"errorMessage":"loading log core module: %v","messagePattern":"loading log core module: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"logging.go","lineNumber":388,"sourceCode":"\t\tcl.encoder = mod.(zapcore.Encoder)\n\n\t\t// if the encoder module needs the writer to determine\n\t\t// the correct default to use for a nested encoder, we\n\t\t// pass it down as a secondary provisioning step\n\t\tif cfd, ok := mod.(ConfiguresFormatterDefault); ok {\n\t\t\tif err := cfd.ConfigureDefaultFormat(cl.writerOpener); err != nil {\n\t\t\t\treturn fmt.Errorf(\"configuring default format for encoder module: %v\", err)\n\t\t\t}\n\t\t}\n\t}\n\tif cl.encoder == nil {\n\t\tcl.encoder = newDefaultProductionLogEncoder(cl.writerOpener)\n\t}\n\tcl.buildCore()\n\tif cl.CoreRaw != nil {\n\t\tmod, err := ctx.LoadModule(cl, \"CoreRaw\")\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"loading log core module: %v\", err)\n\t\t}\n\t\tcore := mod.(zapcore.Core)\n\t\tcl.core = zapcore.NewTee(cl.core, core)\n\t}\n\treturn nil\n}\n\nfunc (cl *BaseLog) buildCore() {\n\t// logs which only discard their output don't need\n\t// to perform encoding or any other processing steps\n\t// at all, so just shortcut to a nop core instead\n\tif _, ok := cl.writerOpener.(*DiscardWriter); ok {\n\t\tcl.core = zapcore.NewNopCore()\n\t\treturn\n\t}\n\tc := zapcore.NewCore(\n\t\tcl.encoder,\n\t\tzapcore.AddSync(cl.writer),","sourceCodeStart":370,"sourceCodeEnd":406,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/logging.go#L370-L406","documentation":"Thrown when ctx.LoadModule fails to load the zapcore.Core module configured under the core key of a log config (CoreRaw). The loaded module is tee'd onto the log's default core, so a bad core module aborts provisioning of the whole logs app.","triggerScenarios":"A logs block with a core { ... } object whose module name is not registered, or whose inline configuration fails the module's own provisioning or validation.","commonSituations":"Custom core modules (e.g. sampling or third-party cores) omitted from an xcaddy build; typos in the core module name; JSON configs where the core object's module-name key is missing; plugin version drift changing the module's config schema.","solutions":["Read the wrapped LoadModule error — 'module not registered' points to a missing/misspelled module ID, other text points to the module's own provisioning.","Correct the core module name or its inline fields.","Rebuild with xcaddy including the plugin that provides the core module.","Remove the core block to use the default core and confirm the rest of the config is valid."],"exampleFix":"// before (json)\n\"logs\": { \"log0\": { \"core\": { \"badcore\": {} } } }\n\n// after\n\"logs\": { \"log0\": { \"core\": { \"zap.core.sampling\": { \"interval\": \"1s\" } } } }","handlingStrategy":"validation","validationCode":"// before load: verify any custom core module id is registered\nfor _, coreID := range coreModuleIDs(cfg) {\n    if _, err := caddy.GetModule(coreID); err != nil {\n        return fmt.Errorf(\"core module %s not in build: %w\", coreID, err)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := caddy.Validate(cfg); err != nil {\n    if strings.Contains(err.Error(), \"loading log core module\") {\n        // core object is invalid: fix module id or inline fields\n    }\n    return err\n}","preventionTips":["Validate configs in CI with 'caddy validate' using the production binary.","Document which plugins each config depends on and build with xcaddy accordingly.","Avoid hand-editing the core block; regenerate from Caddyfile when possible."],"tags":["logging","module-system","zap"],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}