{"record":{"id":"78dea021b0f61c5c","repo":"go-delve/delve","slug":"could-not-find-module-data-for-type-s","errorCode":null,"errorMessage":"could not find module data for type %s","messagePattern":"could not find module data for type (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/types.go","lineNumber":162,"sourceCode":"\tif err != nil {\n\t\treturn 0, false, false, err\n\t}\n\toff, ok := e.Val(godwarf.AttrGoRuntimeType).(uint64)\n\tif !ok {\n\t\treturn 0, false, false, nil\n\t}\n\n\tmds, err := bi.getModuleData(mem)\n\tif err != nil {\n\t\treturn 0, false, false, err\n\t}\n\n\tmd := bi.imageToModuleData(so, mds)\n\tif md == nil {\n\t\tif so.index > 0 {\n\t\t\treturn 0, false, false, fmt.Errorf(\"could not find module data for type %s (shared object: %q)\", typ, so.Path)\n\t\t} else {\n\t\t\treturn 0, false, false, fmt.Errorf(\"could not find module data for type %s\", typ)\n\t\t}\n\t}\n\n\ttypeAddr = md.types + off\n\n\trtyp, err := bi.findType(bi.runtimeTypeTypename())\n\tif err != nil {\n\t\treturn 0, false, false, err\n\t}\n\t_type := newVariable(\"\", typeAddr, rtyp, bi, mem)\n\n\treturn typeAddr, getRuntimeTypeDirect(_type), true, nil\n}\n\n// getRuntimeTypeDirect returns a bool that says if the type in _type can be stored directly into an interface variable.\nfunc getRuntimeTypeDirect(_type *Variable) bool {\n\t// Go 1.26 and beyond have this flag in the TFlag field.\n\t// Go 1.25 and earlier have this flag in the Kind field.","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/types.go#L144-L180","documentation":"dwarfToRuntimeType maps a DWARF type to its Go runtime.reflect_type representation by locating the module data (runtime.moduledata) of the shared object that defines the type. When bi.imageToModuleData cannot find module data matching the type's shared object, the runtime type address cannot be computed (md.types + off) and this error is thrown. It indicates Delve could not correlate the binary's compile unit with a parsed runtime.moduledata.","triggerScenarios":"Calling ConvertEvalScope/evaluate on a variable whose type lives in a shared library or plugin, so executeOp/convertToEface call dwarfToRuntimeType and imageToModuleData returns nil for that shared object (so.index > 0 gives the variant with the so path).","commonSituations":"Debugging Go binaries using cgo shared libraries or -buildmode=plugin; attaching to processes where shared objects were loaded after attach and moduledata scan was stale; stripped or non-Go-built shared objects lacking Go moduledata; mismatched binary on disk vs running process.","solutions":["Rebuild the program as a single static Go binary (avoid -buildmode=plugin/shared) if runtime type conversion of those types is needed.","Ensure the binary on disk matches the running process exactly (same build, not stripped); re-attach after rebuilding.","Check Delve version support for plugins/shared libraries and upgrade Delve.","As a workaround, avoid operations requiring runtime type conversion (interface conversion/comparison of those types) in the debugger."],"exampleFix":"// before: debugging a plugin type via eval\ndlv exec ./app -- eval ifaceVal\n\n// after: rebuild statically and re-debug\ngo build -o app ./cmd/app\ndlv exec ./app -- eval ifaceVal","handlingStrategy":"validation","validationCode":"// Verify the target uses no plugin/shared-library objects before evaluating types\nstate, err := client.GetState()\nif err != nil { return err }\n// If your program uses -buildmode=plugin or cgo shared libs, expect runtime-type\n// conversions on those objects to fail; avoid such evals or rebuild statically.","typeGuard":null,"tryCatchPattern":"// rpc2 client\n_, err := client.EvalVariable(scope, expr, cfg)\nif err != nil && strings.Contains(err.Error(), \"could not find module data for type\") {\n    // fall back to non-runtime-type operations or rebuild statically\n}","preventionTips":["Build a single static Go binary for debugging sessions","Avoid -buildmode=plugin/shared unless necessary","Always debug the exact binary that is running"],"tags":["go","debugger","dwarf","runtime-types","shared-objects"],"backgroundTag":"missing-runtime-module-data","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}