go-delve/delve · warning

unknown type: %T

Error message

unknown type: %T

What it means

convertDBFType (the DWARF-type-to-Variable conversion switch) encountered a godwarf.Type implementation it does not recognize, so the variable is marked Unreadable with this error. Delve supports the standard set of DWARF type kinds (Int, Ptr, Struct, Func, Void, Unspecified, etc.); anything else falls into the default branch.

Source

Thrown at pkg/proc/variables.go:789

	case *godwarf.UintType:
		v.Kind = reflect.Uint
	case *godwarf.FloatType:
		switch t.ByteSize {
		case 4:
			v.Kind = reflect.Float32
		case 8:
			v.Kind = reflect.Float64
		}
	case *godwarf.BoolType:
		v.Kind = reflect.Bool
	case *godwarf.FuncType:
		v.Kind = reflect.Func
	case *godwarf.VoidType:
		v.Kind = reflect.Invalid
	case *godwarf.UnspecifiedType:
		v.Kind = reflect.Invalid
	default:
		v.Unreadable = fmt.Errorf("unknown type: %T", t)
	}

	return v
}

var constantMaxInt64 = constant.MakeInt64(1<<63 - 1)

func newConstant(val constant.Value, bi *BinaryInfo, mem MemoryReadWriter) *Variable {
	v := &Variable{Value: val, mem: mem, loaded: true, bi: bi}
	switch val.Kind() {
	case constant.Int:
		v.Kind = reflect.Int
		if constant.Sign(val) >= 0 && constant.Compare(val, token.GTR, constantMaxInt64) {
			v.Kind = reflect.Uint64
		}
	case constant.Float:
		v.Kind = reflect.Float64
	case constant.Bool:

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Inspect the variable's DWARF type (call TypeString()) to identify the unsupported kind and report it to go-delve/delve.
  2. Upgrade Delve — newer versions handle more DWARF type variants.
  3. Restrict evaluation to variables with plain Go types; restructure code so the exotic type is not on the evaluated path.
Defensive patterns

Strategy: fallback

Type guard

// Skip evaluation when the variable is marked unreadable
if v.Unreadable != nil {
    return fmt.Sprintf("<unreadable: %v>", v.Unreadable)
}

Try / catch

v, err := client.EvalVariable(scope, expr, cfg)
if err == nil && v.Unreadable != nil && strings.Contains(v.Unreadable.Error(), "unknown type:") {
    // unsupported DWARF type: degrade gracefully, show raw info instead
}

Prevention

When it happens

Trigger: Evaluating a variable whose DIE resolves to a godwarf type variant outside the handled cases — typically a custom/exotic DWARF type produced by a non-Go compiler or a DWARF parser edge case producing an unexpected type object.

Common situations: Mixed-language binaries (C/C++ via cgo) with type constructs Delve does not model; DWARF version or producer features newer than the Delve version in use.

Related errors


AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31). Data as JSON: /api/errors/bcc414dd82332c99. Report an issue: GitHub.